Spatial Interaction Models

Author

Federico Jose Rodriguez

Published

November 3, 2024

Modified

November 4, 2024

In this hands-on exercise, we apply functions for modeling spatial interaction using R. We cover both the processing and visualizing of flow data and the calibration of spatial interaction models in this exercise.

This exercise is based on Chapters 15 and 16 of Dr Kam’s online book which can be accessed here.

Getting Started

Data Sources

For this exercise, we will be using the following two sources:

  • Passenger volume by origin and destination bus stops from the LTA Data Mall

  • Bus stop locations based on data from the last quarter of 2022

  • URA Masterplan 2019 Planning Subzone boundary which is already converted into sf dataframe format and saved in an rds file

Installing and launching R packages

This exercise will make use of nine R packages.

  • sf - for importing and processing geospatial data

  • tidyverse - for data importing and wrangling

  • tmap - for creating thematic maps

  • stplanr - for solving common problems in transport planning

  • DT - provides an R interface for JavaScript linrary DataTables

The code chunk below uses p_load() of pacman package to check if the packages are installed in the computer. It installs them first if they are not. It then loads them into R.

pacman::p_load(tmap, sf, sp,
               performance, reshape2,
               ggpubr, tidyverse,
               DT, stplanr)

Processing and Visualizing Flow Data

The first part of the exercise is building an OD matrix based on the first datasource.

Preparing the Flow Data

Importing the OD Data

We first load the passenger volume data by using read_csv() of readr package.

odbus <- read_csv("data/aspatial/origin_destination_bus_202210.csv")
Rows: 5122925 Columns: 7
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): YEAR_MONTH, DAY_TYPE, PT_TYPE
dbl (4): TIME_PER_HOUR, ORIGIN_PT_CODE, DESTINATION_PT_CODE, TOTAL_TRIPS

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

We can use glimpse() to inspect the contents of the odbus object.

glimpse(odbus)
Rows: 5,122,925
Columns: 7
$ YEAR_MONTH          <chr> "2022-10", "2022-10", "2022-10", "2022-10", "2022-…
$ DAY_TYPE            <chr> "WEEKDAY", "WEEKENDS/HOLIDAY", "WEEKENDS/HOLIDAY",…
$ TIME_PER_HOUR       <dbl> 10, 10, 7, 11, 16, 16, 20, 7, 7, 11, 11, 8, 11, 11…
$ PT_TYPE             <chr> "BUS", "BUS", "BUS", "BUS", "BUS", "BUS", "BUS", "…
$ ORIGIN_PT_CODE      <dbl> 65239, 65239, 23519, 52509, 54349, 54349, 43371, 8…
$ DESTINATION_PT_CODE <dbl> 65159, 65159, 23311, 42041, 53241, 53241, 14139, 9…
$ TOTAL_TRIPS         <dbl> 2, 1, 2, 1, 1, 4, 1, 3, 1, 5, 2, 5, 15, 40, 1, 1, …

The origin and destination codes are imported as numeric data type. We use the following code chunk to convert them into characters or categorical type.

odbus$ORIGIN_PT_CODE <- as.factor(odbus$ORIGIN_PT_CODE)
odbus$DESTINATION_PT_CODE <- as.factor(odbus$DESTINATION_PT_CODE) 

Extracting the study data

For this study, we focus on the activity on weekdays between 6pm and 9pm. The code chunk below extracts the relevant data based on that.

odbus6_9 <- odbus %>%
  filter(DAY_TYPE == "WEEKDAY") %>%
  filter(TIME_PER_HOUR >= 6 &
           TIME_PER_HOUR <= 9) %>%
  group_by(ORIGIN_PT_CODE,
           DESTINATION_PT_CODE) %>%
  summarise(TRIPS = sum(TOTAL_TRIPS))
`summarise()` has grouped output by 'ORIGIN_PT_CODE'. You can override using
the `.groups` argument.

We can display the contents as a table using the following code which uses the DT package.

datatable(odbus6_9)
Warning in instance$preRenderHook(instance): It seems your data is too big for
client-side DataTables. You may consider server-side processing:
https://rstudio.github.io/DT/server.html

We can save the output for future use using the code chunk below

write_rds(odbus6_9, "data/rds/odbus6_9.rds")

The following code chunk reloads the same data.

odbus6_9 <- read_rds("chap15/data/rds/odbus6_9.rds")

Importing Geospatial Data

We use the code chunk below to load the bus stop locations into R.

busstop <- st_read(dsn = "data/geospatial",
                   layer = "BusStop") %>%
  st_transform(crs = 3414)
Reading layer `BusStop' from data source 
  `C:\drkrodriguez\ISSS626-GAA\Hands-on\Hands-On_Ex13\data\geospatial' 
  using driver `ESRI Shapefile'
Simple feature collection with 5159 features and 3 fields
Geometry type: POINT
Dimension:     XY
Bounding box:  xmin: 3970.122 ymin: 26482.1 xmax: 48284.56 ymax: 52983.82
Projected CRS: SVY21

The following code chunk loads the masterplan subzone boudaries

mpsz <- st_read(dsn = "data/geospatial",
                   layer = "MPSZ-2019") %>%
  st_transform(crs = 3414)
Reading layer `MPSZ-2019' from data source 
  `C:\drkrodriguez\ISSS626-GAA\Hands-on\Hands-On_Ex13\data\geospatial' 
  using driver `ESRI Shapefile'
Simple feature collection with 332 features and 6 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 103.6057 ymin: 1.158699 xmax: 104.0885 ymax: 1.470775
Geodetic CRS:  WGS 84

Geospatial Data wrangling

The code chunk below combines the busstop and mpsz data by populating the planning subzone code into the busstop object.

busstop_mpsz <- st_intersection(busstop, mpsz) %>%
  select(BUS_STOP_N, SUBZONE_C) %>%
  st_drop_geometry()
Warning: attribute variables are assumed to be spatially constant throughout
all geometries
datatable(busstop_mpsz)

We can save the output into an rds file to save our work up to this point.

write_rds(busstop_mpsz, "data/rds/busstop_mpsz.rds")  

Next, we use the code chunk below to append the planning subzone code of the origin onto odbus6_9

od_data <- left_join(odbus6_9 , busstop_mpsz,
            by = c("ORIGIN_PT_CODE" = "BUS_STOP_N")) %>%
  rename(ORIGIN_BS = ORIGIN_PT_CODE,
         ORIGIN_SZ = SUBZONE_C,
         DESTIN_BS = DESTINATION_PT_CODE)
Warning in left_join(odbus6_9, busstop_mpsz, by = c(ORIGIN_PT_CODE = "BUS_STOP_N")): Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 55491 of `x` matches multiple rows in `y`.
ℹ Row 161 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
  "many-to-many"` to silence this warning.

We check if there are any duplicated records using the code chunk below

duplicate <- od_data %>%
  group_by_all() %>%
  filter(n()>1) %>%
  ungroup()
datatable(duplicate)

We see that there are quite a number of duplicated records. We use the code chunk below to remove duplicates

od_data <- unique(od_data)

We then update the object with the planning subzone code of the destination using the code chunk below and then remove any duplicates

od_data <- left_join(od_data , busstop_mpsz,
            by = c("DESTIN_BS" = "BUS_STOP_N")) 
Warning in left_join(od_data, busstop_mpsz, by = c(DESTIN_BS = "BUS_STOP_N")): Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 74 of `x` matches multiple rows in `y`.
ℹ Row 1379 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
  "many-to-many"` to silence this warning.
od_data <- unique(od_data)
od_data <- od_data %>%
  rename(DESTIN_SZ = SUBZONE_C) %>%
  drop_na() %>%
  group_by(ORIGIN_SZ, DESTIN_SZ) %>%
  summarise(MORNING_PEAK = sum(TRIPS))
`summarise()` has grouped output by 'ORIGIN_SZ'. You can override using the
`.groups` argument.

We can save this into an rds file to be able to preserve our work so far.

write_rds(od_data, "data/rds/od_data_fii.rds")
od_data_fii <- read_rds("data/rds/od_data.rds")

Visualizing Spatial Interaction

In this section, we learn about using the stplanr package to prepare desire lines

Removing intra-zonal flows

We are not interested in intra-zonal flows. As such, we use the code below to remove them

od_data_fij <- od_data[od_data$ORIGIN_SZ!=od_data$DESTIN_SZ,]

Creating desire lines

In the code below, we use od2line() of stplanr package to create the desire lines

flowLine <- od2line(flow = od_data_fii, 
                    zones = mpsz,
                    zone_code = "SUBZONE_C")
Creating centroids representing desire line start and end points.

Visualizing the desire lines

To visualize the desire lines, the code chunk below can be used.

tm_shape(mpsz) +
  tm_polygons() +
flowLine %>%  
tm_shape() +
  tm_lines(lwd = "MORNING_PEAK",
           style = "quantile",
           scale = c(0.1, 1, 3, 5, 7, 10),
           n = 6,
           alpha = 0.3)
Warning in g$scale * (w_legend/maxW): longer object length is not a multiple of
shorter object length
Warning in g$scale * (x/maxW): longer object length is not a multiple of
shorter object length

When there are too many flow lines rendering the visualization ineffective, it is wise to just focus on a subset of flows. The code chunk below just shows the flows with value of at least 5000

tm_shape(mpsz) +
  tm_polygons() +
flowLine %>%  
  filter(MORNING_PEAK >= 5000) %>%
tm_shape() +
  tm_lines(lwd = "MORNING_PEAK",
           style = "quantile",
           scale = c(0.1, 1, 3, 5, 7, 10),
           n = 6,
           alpha = 0.3)
Warning in g$scale * (w_legend/maxW): longer object length is not a multiple of
shorter object length
Warning in g$scale * (x/maxW): longer object length is not a multiple of
shorter object length

Calibrating Spatial Interaction Models with R

Spatial interaction models or SIMs are models for estimating flows between entitites and has four main types:

  • Unconstrained

  • Production-constrained

  • Attraction-coonstrained

  • Doubly-constrained

We continue working with the same data to determine factors affecting public bus passenger flows during morning peak hours.

Computing the Distance Matrix

Converting the sf data table to SpatialPolygonsDataFrame

The distance matrix can be computed using sf or sp. Previous runs have shown that computing the distance matrix using sp rather than sf is faster so we will be using that here.

First, we convert the subzone boundaries into a SpatialPolygonsDataFrame using the following code chunk

mpsz_sp <- as(mpsz, "Spatial")
mpsz_sp
class       : SpatialPolygonsDataFrame 
features    : 332 
extent      : 2667.538, 56396.44, 15748.72, 50256.33  (xmin, xmax, ymin, ymax)
crs         : +proj=tmerc +lat_0=1.36666666666667 +lon_0=103.833333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs 
variables   : 6
names       : SUBZONE_N, SUBZONE_C, PLN_AREA_N, PLN_AREA_C,       REGION_N, REGION_C 
min values  : ADMIRALTY,    AMSZ01, ANG MO KIO,         AM, CENTRAL REGION,       CR 
max values  :    YUNNAN,    YSSZ09,     YISHUN,         YS,    WEST REGION,       WR 

Computing the distance matrix

We can use spDists() of sp package in the code chunk below to compute for the Euclidean distance between centroids of the subzones.

dist <- spDists(mpsz_sp, 
                longlat = FALSE)
head(dist, n=c(10, 10))
           [,1]       [,2]      [,3]      [,4]       [,5]      [,6]      [,7]
 [1,]     0.000  3926.0025  3939.108 20252.964  2989.9839  1431.330 19211.836
 [2,]  3926.003     0.0000   305.737 16513.865   951.8314  5254.066 16242.523
 [3,]  3939.108   305.7370     0.000 16412.062  1045.9088  5299.849 16026.146
 [4,] 20252.964 16513.8648 16412.062     0.000 17450.3044 21665.795  7229.017
 [5,]  2989.984   951.8314  1045.909 17450.304     0.0000  4303.232 17020.916
 [6,]  1431.330  5254.0664  5299.849 21665.795  4303.2323     0.000 20617.082
 [7,] 19211.836 16242.5230 16026.146  7229.017 17020.9161 20617.082     0.000
 [8,] 14960.942 12749.4101 12477.871 11284.279 13336.0421 16281.453  5606.082
 [9,]  7515.256  7934.8082  7649.776 18427.503  7801.6163  8403.896 14810.930
[10,]  6391.342  4975.0021  4669.295 15469.566  5226.8731  7707.091 13111.391
           [,8]      [,9]     [,10]
 [1,] 14960.942  7515.256  6391.342
 [2,] 12749.410  7934.808  4975.002
 [3,] 12477.871  7649.776  4669.295
 [4,] 11284.279 18427.503 15469.566
 [5,] 13336.042  7801.616  5226.873
 [6,] 16281.453  8403.896  7707.091
 [7,]  5606.082 14810.930 13111.391
 [8,]     0.000  9472.024  8575.490
 [9,]  9472.024     0.000  3780.800
[10,]  8575.490  3780.800     0.000

Labeling row and column names

We first create a sorted list according to the distance matrix based on the planning zone subcode

sz_names <- mpsz$SUBZONE_C

Next we attach the subzone names to the row and column headers

colnames(dist) <- paste0(sz_names)
rownames(dist) <- paste0(sz_names)

Pivoting distance value by subzone name

We use the code chunk below to unpivot the distance matrix into a long table by using the subzone codes

distPair <- melt(dist) %>%
  rename(dist = value)
head(distPair, 10)
     Var1   Var2      dist
1  MESZ01 MESZ01     0.000
2  RVSZ05 MESZ01  3926.003
3  SRSZ01 MESZ01  3939.108
4  WISZ01 MESZ01 20252.964
5  MUSZ02 MESZ01  2989.984
6  MPSZ05 MESZ01  1431.330
7  WISZ03 MESZ01 19211.836
8  WISZ02 MESZ01 14960.942
9  SISZ02 MESZ01  7515.256
10 SISZ01 MESZ01  6391.342

We see that intrazone distances appear as zero here

Updating intrazonal distances

We use this section to raplce the intrazonal distance with another constant

We first use summary() to select and fin the minim value of the distance

distPair %>%
  filter(dist > 0) %>%
  summary()
      Var1             Var2             dist        
 MESZ01 :   331   MESZ01 :   331   Min.   :  173.8  
 RVSZ05 :   331   RVSZ05 :   331   1st Qu.: 7149.5  
 SRSZ01 :   331   SRSZ01 :   331   Median :11890.0  
 WISZ01 :   331   WISZ01 :   331   Mean   :12229.4  
 MUSZ02 :   331   MUSZ02 :   331   3rd Qu.:16401.7  
 MPSZ05 :   331   MPSZ05 :   331   Max.   :49894.4  
 (Other):107906   (Other):107906                    

Next, we replace the distance with a value of 50 if its current is zero

distPair$dist <- ifelse(distPair$dist == 0,
                        50, distPair$dist)

The code chunk below checks the resulting dataframe

distPair %>%
  summary()
      Var1             Var2             dist      
 MESZ01 :   332   MESZ01 :   332   Min.   :   50  
 RVSZ05 :   332   RVSZ05 :   332   1st Qu.: 7097  
 SRSZ01 :   332   SRSZ01 :   332   Median :11864  
 WISZ01 :   332   WISZ01 :   332   Mean   :12193  
 MUSZ02 :   332   MUSZ02 :   332   3rd Qu.:16388  
 MPSZ05 :   332   MPSZ05 :   332   Max.   :49894  
 (Other):108232   (Other):108232                  

We then use the following to rename the origin and the destination fields

distPair <- distPair %>%
  rename(orig = Var1,
         dest = Var2)

Preparing the flow data

We will start with the od_data_fii object for this step.

We compute the total number of passenger trips between and within subzone using the code chunk below

flow_data <- od_data_fii %>%
  group_by(ORIGIN_SZ, DESTIN_SZ) %>% 
  summarize(TRIPS = sum(MORNING_PEAK)) 
`summarise()` has grouped output by 'ORIGIN_SZ'. You can override using the
`.groups` argument.

We show the first ten records using the code chunk below

head(flow_data, 10)
# A tibble: 10 × 3
# Groups:   ORIGIN_SZ [1]
   ORIGIN_SZ DESTIN_SZ TRIPS
   <chr>     <chr>     <dbl>
 1 AMSZ01    AMSZ01     1998
 2 AMSZ01    AMSZ02     8289
 3 AMSZ01    AMSZ03     8971
 4 AMSZ01    AMSZ04     2252
 5 AMSZ01    AMSZ05     6136
 6 AMSZ01    AMSZ06     2148
 7 AMSZ01    AMSZ07     1620
 8 AMSZ01    AMSZ08     1925
 9 AMSZ01    AMSZ09     1773
10 AMSZ01    AMSZ10       63

Separating intra-flow from passenger volume

We use the code chunk below to create three new fields in the dataframe

flow_data$FlowNoIntra <- ifelse(
  flow_data$ORIGIN_SZ == flow_data$DESTIN_SZ, 
  0, flow_data$TRIPS)
flow_data$offset <- ifelse(
  flow_data$ORIGIN_SZ == flow_data$DESTIN_SZ, 
  0.000001, 1)

Combining passenger volume data with distance value

We first need to convert the data type of the origin and destinations into factors using the code chunk below

flow_data$ORIGIN_SZ <- as.factor(flow_data$ORIGIN_SZ)
flow_data$DESTIN_SZ <- as.factor(flow_data$DESTIN_SZ)

Next, we combine flow_data and distPair using left_join()

flow_data1 <- flow_data %>%
  left_join (distPair,
             by = c("ORIGIN_SZ" = "orig",
                    "DESTIN_SZ" = "dest"))

Preparing Origin and Destination Attributes

Importing population data

pop <- read_csv("data/aspatial/pop.csv")
Rows: 332 Columns: 5
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): PA, SZ
dbl (3): AGE7_12, AGE13_24, AGE25_64

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
pop1 <- pop %>%
  left_join(st_drop_geometry(mpsz), by = c(SZ = "SUBZONE_N"))

Preparing origin and destination attribute

flow_data1 <- flow_data1 %>%
  left_join(pop1,
            by = c(ORIGIN_SZ = "SUBZONE_C")) %>%
  rename(ORIGIN_AGE7_12 = AGE7_12,
         ORIGIN_AGE13_24 = AGE13_24,
         ORIGIN_AGE25_64 = AGE25_64) %>%
  select(-c(PA))

flow_data1 <- flow_data1 %>%
  left_join(pop1,
            by = c(DESTIN_SZ = "SUBZONE_C")) %>%
  rename(DESTIN_AGE7_12 = AGE7_12,
         DESTIN_AGE13_24 = AGE13_24,
         DESTIN_AGE25_64 = AGE25_64) %>%
  select(-c(PA))

Calibrating Spatial Interaction models

Importing the modelling data

We rename the last object to indicate it as the modeling data

SIM_data <- flow_data1

Visualizing the dependent variable

We can plot the distribution of the dependent variable using ggplot package

ggplot(data = SIM_data,
       aes(x = TRIPS)) +
  geom_histogram()
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

The distribution is highly skewed and far from normal

We can visualize the relationship between the dependent variable and an independent variable like distance using the code chunk below

ggplot(data = SIM_data,
       aes(x = dist,
           y = TRIPS)) +
  geom_point() +
  geom_smooth(method = lm)
`geom_smooth()` using formula = 'y ~ x'

The plot doesn’t show a linear relationship between these variables

Alternatively, we can use a log transformed version of these variables and see the relationship of those

ggplot(data = SIM_data,
       aes(x = log(dist),
           y = log(TRIPS))) +
  geom_point() +
  geom_smooth(method = lm)
`geom_smooth()` using formula = 'y ~ x'

Checking for variables with zero values

Since the log of a zero value is underfined, it is important to ensure that there are no zeros especially for Poisson regression.

The code chunk below displays summary statistics for all numeric variables.

summary(SIM_data)
  ORIGIN_SZ          DESTIN_SZ             TRIPS         FlowNoIntra      
 Length:14734       Length:14734       Min.   :     1   Min.   :     0.0  
 Class :character   Class :character   1st Qu.:    14   1st Qu.:    13.0  
 Mode  :character   Mode  :character   Median :    76   Median :    70.0  
                                       Mean   :  1021   Mean   :   839.9  
                                       3rd Qu.:   426   3rd Qu.:   379.0  
                                       Max.   :232187   Max.   :148274.0  
     offset              dist           SZ.x           ORIGIN_AGE7_12
 Min.   :0.000001   Min.   :   50   Length:14734       Min.   :   0  
 1st Qu.:1.000000   1st Qu.: 3346   Class :character   1st Qu.: 240  
 Median :1.000000   Median : 6067   Mode  :character   Median : 700  
 Mean   :0.982150   Mean   : 6880                      Mean   :1032  
 3rd Qu.:1.000000   3rd Qu.: 9729                      3rd Qu.:1480  
 Max.   :1.000000   Max.   :26136                      Max.   :6340  
 ORIGIN_AGE13_24 ORIGIN_AGE25_64 PLN_AREA_N.x       PLN_AREA_C.x      
 Min.   :    0   Min.   :    0   Length:14734       Length:14734      
 1st Qu.:  440   1st Qu.: 2200   Class :character   Class :character  
 Median : 1350   Median : 6810   Mode  :character   Mode  :character  
 Mean   : 2269   Mean   :10487                                        
 3rd Qu.: 3260   3rd Qu.:15770                                        
 Max.   :16380   Max.   :74610                                        
  REGION_N.x         REGION_C.x            SZ.y           DESTIN_AGE7_12
 Length:14734       Length:14734       Length:14734       Min.   :   0  
 Class :character   Class :character   Class :character   1st Qu.: 240  
 Mode  :character   Mode  :character   Mode  :character   Median : 720  
                                                          Mean   :1033  
                                                          3rd Qu.:1500  
                                                          Max.   :6340  
 DESTIN_AGE13_24 DESTIN_AGE25_64 PLN_AREA_N.y       PLN_AREA_C.y      
 Min.   :    0   Min.   :    0   Length:14734       Length:14734      
 1st Qu.:  460   1st Qu.: 2200   Class :character   Class :character  
 Median : 1420   Median : 7030   Mode  :character   Mode  :character  
 Mean   : 2290   Mean   :10574                                        
 3rd Qu.: 3260   3rd Qu.:15830                                        
 Max.   :16380   Max.   :74610                                        
  REGION_N.y         REGION_C.y       
 Length:14734       Length:14734      
 Class :character   Class :character  
 Mode  :character   Mode  :character  
                                      
                                      
                                      

The report shows some variables that have zero values. We use the code chunk below to replace any zero values for those variables with 0.99

SIM_data$DESTIN_AGE7_12 <- ifelse(
  SIM_data$DESTIN_AGE7_12 == 0,
  0.99, SIM_data$DESTIN_AGE7_12)
SIM_data$DESTIN_AGE13_24 <- ifelse(
  SIM_data$DESTIN_AGE13_24 == 0,
  0.99, SIM_data$DESTIN_AGE13_24)
SIM_data$DESTIN_AGE25_64 <- ifelse(
  SIM_data$DESTIN_AGE25_64 == 0,
  0.99, SIM_data$DESTIN_AGE25_64)
SIM_data$ORIGIN_AGE7_12 <- ifelse(
  SIM_data$ORIGIN_AGE7_12 == 0,
  0.99, SIM_data$ORIGIN_AGE7_12)
SIM_data$ORIGIN_AGE13_24 <- ifelse(
  SIM_data$ORIGIN_AGE13_24 == 0,
  0.99, SIM_data$ORIGIN_AGE13_24)
SIM_data$ORIGIN_AGE25_64 <- ifelse(
  SIM_data$ORIGIN_AGE25_64 == 0,
  0.99, SIM_data$ORIGIN_AGE25_64)

Unconstrained spatial interaction model

The code chunk below uses glm() to calibrate a spatial interaction model

uncSIM <- glm(formula = TRIPS ~ 
                log(ORIGIN_AGE25_64) + 
                log(DESTIN_AGE25_64) +
                log(dist),
              family = poisson(link = "log"),
              data = SIM_data,
              na.action = na.exclude)
uncSIM

Call:  glm(formula = TRIPS ~ log(ORIGIN_AGE25_64) + log(DESTIN_AGE25_64) + 
    log(dist), family = poisson(link = "log"), data = SIM_data, 
    na.action = na.exclude)

Coefficients:
         (Intercept)  log(ORIGIN_AGE25_64)  log(DESTIN_AGE25_64)  
           10.407308              0.244859              0.009562  
           log(dist)  
           -0.705896  

Degrees of Freedom: 14733 Total (i.e. Null);  14730 Residual
Null Deviance:      60800000 
Residual Deviance: 36430000     AIC: 36520000

R-squared function

We write a function to compute for the R-squared value in order to measure the variation in the number of trips accounted for by the model

CalcRSquared <- function(observed,estimated){
  r <- cor(observed,estimated)
  R2 <- r^2
  R2
}

We compute for the R-squared of the unconstrained SIM using the code chunk below

CalcRSquared(uncSIM$data$TRIPS, uncSIM$fitted.values)
[1] 0.1892576
r2_mcfadden(uncSIM)
# R2 for Generalized Linear Regression
       R2: 0.400
  adj. R2: 0.400

Origin constrained SIM

The code chunk below fits an origin constrained model

orcSIM <- glm(formula = TRIPS ~ 
                 ORIGIN_SZ +
                 log(DESTIN_AGE25_64) +
                 log(dist),
              family = poisson(link = "log"),
              data = SIM_data,
              na.action = na.exclude)
summary(orcSIM)

Call:
glm(formula = TRIPS ~ ORIGIN_SZ + log(DESTIN_AGE25_64) + log(dist), 
    family = poisson(link = "log"), data = SIM_data, na.action = na.exclude)

Coefficients:
                       Estimate Std. Error   z value Pr(>|z|)    
(Intercept)           1.211e+01  3.785e-03  3199.012  < 2e-16 ***
ORIGIN_SZAMSZ02       1.008e+00  4.450e-03   226.401  < 2e-16 ***
ORIGIN_SZAMSZ03       5.474e-01  4.563e-03   119.959  < 2e-16 ***
ORIGIN_SZAMSZ04      -7.494e-02  5.187e-03   -14.448  < 2e-16 ***
ORIGIN_SZAMSZ05      -2.006e-01  5.790e-03   -34.650  < 2e-16 ***
ORIGIN_SZAMSZ06       4.193e-01  5.130e-03    81.736  < 2e-16 ***
ORIGIN_SZAMSZ07      -1.372e+00  9.683e-03  -141.686  < 2e-16 ***
ORIGIN_SZAMSZ08      -1.022e+00  8.956e-03  -114.087  < 2e-16 ***
ORIGIN_SZAMSZ09       2.239e-01  5.408e-03    41.396  < 2e-16 ***
ORIGIN_SZAMSZ10       5.061e-01  4.716e-03   107.311  < 2e-16 ***
ORIGIN_SZAMSZ11      -1.856e+00  1.285e-02  -144.414  < 2e-16 ***
ORIGIN_SZAMSZ12      -1.580e+00  1.076e-02  -146.883  < 2e-16 ***
ORIGIN_SZBDSZ01       1.072e+00  4.345e-03   246.734  < 2e-16 ***
ORIGIN_SZBDSZ02       5.198e-01  5.079e-03   102.340  < 2e-16 ***
ORIGIN_SZBDSZ03       9.865e-01  4.490e-03   219.724  < 2e-16 ***
ORIGIN_SZBDSZ04       1.767e+00  3.894e-03   453.646  < 2e-16 ***
ORIGIN_SZBDSZ05       6.395e-01  4.546e-03   140.691  < 2e-16 ***
ORIGIN_SZBDSZ06       9.363e-01  4.543e-03   206.094  < 2e-16 ***
ORIGIN_SZBDSZ07      -1.281e+00  9.558e-03  -133.991  < 2e-16 ***
ORIGIN_SZBDSZ08      -1.167e+00  9.032e-03  -129.194  < 2e-16 ***
ORIGIN_SZBKSZ01      -4.540e-01  6.538e-03   -69.437  < 2e-16 ***
ORIGIN_SZBKSZ02       3.736e-01  5.115e-03    73.050  < 2e-16 ***
ORIGIN_SZBKSZ03       5.841e-01  4.934e-03   118.375  < 2e-16 ***
ORIGIN_SZBKSZ04      -1.177e-01  5.914e-03   -19.895  < 2e-16 ***
ORIGIN_SZBKSZ05      -2.164e-01  5.832e-03   -37.115  < 2e-16 ***
ORIGIN_SZBKSZ06       3.684e-03  5.873e-03     0.627  0.53048    
ORIGIN_SZBKSZ07       7.456e-01  4.426e-03   168.439  < 2e-16 ***
ORIGIN_SZBKSZ08      -2.279e-02  5.348e-03    -4.261 2.04e-05 ***
ORIGIN_SZBKSZ09      -9.572e-02  5.721e-03   -16.733  < 2e-16 ***
ORIGIN_SZBLSZ01      -1.688e+00  1.482e-02  -113.887  < 2e-16 ***
ORIGIN_SZBLSZ02      -2.154e+00  1.924e-02  -111.980  < 2e-16 ***
ORIGIN_SZBLSZ03      -3.249e+00  3.930e-02   -82.662  < 2e-16 ***
ORIGIN_SZBLSZ04      -2.203e+00  2.306e-02   -95.557  < 2e-16 ***
ORIGIN_SZBMSZ01      -1.267e-01  5.222e-03   -24.266  < 2e-16 ***
ORIGIN_SZBMSZ02      -1.075e+00  6.742e-03  -159.386  < 2e-16 ***
ORIGIN_SZBMSZ03      -4.386e-01  5.794e-03   -75.707  < 2e-16 ***
ORIGIN_SZBMSZ04      -6.333e-02  5.157e-03   -12.280  < 2e-16 ***
ORIGIN_SZBMSZ05      -2.256e+00  1.247e-02  -180.957  < 2e-16 ***
ORIGIN_SZBMSZ06      -2.378e+00  1.618e-02  -147.029  < 2e-16 ***
ORIGIN_SZBMSZ07      -4.769e-01  5.653e-03   -84.362  < 2e-16 ***
ORIGIN_SZBMSZ08      -5.652e-01  5.811e-03   -97.259  < 2e-16 ***
ORIGIN_SZBMSZ09      -1.232e+00  8.688e-03  -141.760  < 2e-16 ***
ORIGIN_SZBMSZ10      -1.471e+00  9.130e-03  -161.131  < 2e-16 ***
ORIGIN_SZBMSZ11      -7.866e-01  6.595e-03  -119.263  < 2e-16 ***
ORIGIN_SZBMSZ12      -1.072e+00  9.149e-03  -117.206  < 2e-16 ***
ORIGIN_SZBMSZ13      -1.207e-01  5.691e-03   -21.218  < 2e-16 ***
ORIGIN_SZBMSZ14      -5.376e-01  6.629e-03   -81.098  < 2e-16 ***
ORIGIN_SZBMSZ15      -3.253e-01  6.054e-03   -53.740  < 2e-16 ***
ORIGIN_SZBMSZ16      -1.548e+00  9.144e-03  -169.303  < 2e-16 ***
ORIGIN_SZBMSZ17      -2.169e+00  1.576e-02  -137.622  < 2e-16 ***
ORIGIN_SZBPSZ01       1.369e-01  5.553e-03    24.660  < 2e-16 ***
ORIGIN_SZBPSZ02      -3.292e-02  6.462e-03    -5.094 3.50e-07 ***
ORIGIN_SZBPSZ03       1.491e-01  6.149e-03    24.241  < 2e-16 ***
ORIGIN_SZBPSZ04       3.544e-01  5.084e-03    69.711  < 2e-16 ***
ORIGIN_SZBPSZ05       5.454e-01  4.554e-03   119.764  < 2e-16 ***
ORIGIN_SZBPSZ06      -1.406e+00  9.311e-03  -151.045  < 2e-16 ***
ORIGIN_SZBPSZ07      -1.004e+00  8.575e-03  -117.068  < 2e-16 ***
ORIGIN_SZBSSZ01      -1.625e-02  5.276e-03    -3.080  0.00207 ** 
ORIGIN_SZBSSZ02       3.088e-01  4.787e-03    64.495  < 2e-16 ***
ORIGIN_SZBSSZ03       2.555e-01  4.689e-03    54.487  < 2e-16 ***
ORIGIN_SZBTSZ01      -6.646e-02  5.385e-03   -12.340  < 2e-16 ***
ORIGIN_SZBTSZ02      -1.078e+00  7.797e-03  -138.225  < 2e-16 ***
ORIGIN_SZBTSZ03      -2.284e-01  5.727e-03   -39.876  < 2e-16 ***
ORIGIN_SZBTSZ04      -1.053e+00  1.019e-02  -103.339  < 2e-16 ***
ORIGIN_SZBTSZ05      -1.647e+00  1.100e-02  -149.690  < 2e-16 ***
ORIGIN_SZBTSZ06      -7.804e-01  7.181e-03  -108.682  < 2e-16 ***
ORIGIN_SZBTSZ07      -2.298e+00  1.321e-02  -173.921  < 2e-16 ***
ORIGIN_SZBTSZ08      -1.283e+00  9.394e-03  -136.560  < 2e-16 ***
ORIGIN_SZCBSZ01      -1.911e+00  5.483e-02   -34.844  < 2e-16 ***
ORIGIN_SZCCSZ01      -1.758e+00  1.331e-02  -132.099  < 2e-16 ***
ORIGIN_SZCHSZ01      -1.236e+00  1.178e-02  -104.954  < 2e-16 ***
ORIGIN_SZCHSZ02      -5.424e-01  7.940e-03   -68.307  < 2e-16 ***
ORIGIN_SZCHSZ03       4.332e-01  5.841e-03    74.153  < 2e-16 ***
ORIGIN_SZCKSZ01       1.843e-01  5.117e-03    36.007  < 2e-16 ***
ORIGIN_SZCKSZ02       6.800e-01  5.087e-03   133.672  < 2e-16 ***
ORIGIN_SZCKSZ03       8.030e-01  4.522e-03   177.574  < 2e-16 ***
ORIGIN_SZCKSZ04       1.298e+00  4.562e-03   284.446  < 2e-16 ***
ORIGIN_SZCKSZ05       1.011e+00  5.305e-03   190.602  < 2e-16 ***
ORIGIN_SZCKSZ06       1.262e+00  5.042e-03   250.262  < 2e-16 ***
ORIGIN_SZCLSZ01      -6.805e-01  7.661e-03   -88.836  < 2e-16 ***
ORIGIN_SZCLSZ02      -1.837e+00  1.364e-02  -134.665  < 2e-16 ***
ORIGIN_SZCLSZ03      -1.001e+00  7.949e-03  -125.969  < 2e-16 ***
ORIGIN_SZCLSZ04       6.966e-01  4.460e-03   156.204  < 2e-16 ***
ORIGIN_SZCLSZ05      -1.974e+00  1.474e-02  -133.906  < 2e-16 ***
ORIGIN_SZCLSZ06       8.585e-01  4.204e-03   204.230  < 2e-16 ***
ORIGIN_SZCLSZ07      -2.974e-01  5.575e-03   -53.346  < 2e-16 ***
ORIGIN_SZCLSZ08       3.231e-01  5.802e-03    55.688  < 2e-16 ***
ORIGIN_SZCLSZ09      -1.697e+00  1.555e-02  -109.106  < 2e-16 ***
ORIGIN_SZDTSZ02      -4.061e+00  8.341e-02   -48.693  < 2e-16 ***
ORIGIN_SZDTSZ03      -4.031e+00  7.381e-02   -54.618  < 2e-16 ***
ORIGIN_SZDTSZ13      -3.000e+00  3.129e-02   -95.889  < 2e-16 ***
ORIGIN_SZGLSZ01      -1.405e+00  9.192e-03  -152.876  < 2e-16 ***
ORIGIN_SZGLSZ02       2.536e-01  4.889e-03    51.880  < 2e-16 ***
ORIGIN_SZGLSZ03       2.411e-01  4.855e-03    49.649  < 2e-16 ***
ORIGIN_SZGLSZ04       8.350e-01  4.200e-03   198.826  < 2e-16 ***
ORIGIN_SZGLSZ05       6.207e-01  4.375e-03   141.857  < 2e-16 ***
ORIGIN_SZHGSZ01       2.806e-01  4.746e-03    59.121  < 2e-16 ***
ORIGIN_SZHGSZ02       4.917e-01  4.712e-03   104.351  < 2e-16 ***
ORIGIN_SZHGSZ03       2.452e-01  5.113e-03    47.952  < 2e-16 ***
ORIGIN_SZHGSZ04       9.052e-01  4.303e-03   210.358  < 2e-16 ***
ORIGIN_SZHGSZ05       1.170e+00  4.253e-03   275.033  < 2e-16 ***
ORIGIN_SZHGSZ06      -1.016e-01  5.413e-03   -18.773  < 2e-16 ***
ORIGIN_SZHGSZ07       6.984e-01  4.455e-03   156.757  < 2e-16 ***
ORIGIN_SZHGSZ08       1.005e-01  5.354e-03    18.781  < 2e-16 ***
ORIGIN_SZHGSZ09      -5.390e-01  6.962e-03   -77.417  < 2e-16 ***
ORIGIN_SZHGSZ10      -3.512e+00  4.211e-02   -83.388  < 2e-16 ***
ORIGIN_SZJESZ01       4.022e-01  4.869e-03    82.601  < 2e-16 ***
ORIGIN_SZJESZ02       2.273e-01  4.924e-03    46.158  < 2e-16 ***
ORIGIN_SZJESZ03       1.829e-01  5.286e-03    34.598  < 2e-16 ***
ORIGIN_SZJESZ04      -1.177e+00  9.142e-03  -128.767  < 2e-16 ***
ORIGIN_SZJESZ05      -2.065e+00  1.382e-02  -149.494  < 2e-16 ***
ORIGIN_SZJESZ06       2.301e-01  4.853e-03    47.410  < 2e-16 ***
ORIGIN_SZJESZ07      -1.889e+00  1.183e-02  -159.599  < 2e-16 ***
ORIGIN_SZJESZ08      -1.062e+00  1.147e-02   -92.551  < 2e-16 ***
ORIGIN_SZJESZ09       5.237e-01  4.959e-03   105.612  < 2e-16 ***
ORIGIN_SZJESZ10      -1.829e+00  1.800e-02  -101.616  < 2e-16 ***
ORIGIN_SZJESZ11      -2.023e+00  1.931e-02  -104.738  < 2e-16 ***
ORIGIN_SZJWSZ01       2.125e-01  6.405e-03    33.183  < 2e-16 ***
ORIGIN_SZJWSZ02       8.858e-01  4.521e-03   195.929  < 2e-16 ***
ORIGIN_SZJWSZ03       1.269e+00  4.188e-03   302.922  < 2e-16 ***
ORIGIN_SZJWSZ04       1.284e+00  4.280e-03   300.017  < 2e-16 ***
ORIGIN_SZJWSZ05      -1.393e+00  1.252e-02  -111.339  < 2e-16 ***
ORIGIN_SZJWSZ06      -1.015e+00  1.067e-02   -95.109  < 2e-16 ***
ORIGIN_SZJWSZ07      -2.694e+00  2.751e-02   -97.911  < 2e-16 ***
ORIGIN_SZJWSZ08       1.950e+00  4.110e-03   474.430  < 2e-16 ***
ORIGIN_SZJWSZ09       1.831e+00  3.899e-03   469.595  < 2e-16 ***
ORIGIN_SZKLSZ01       1.636e-01  4.902e-03    33.374  < 2e-16 ***
ORIGIN_SZKLSZ02      -5.156e-01  6.321e-03   -81.570  < 2e-16 ***
ORIGIN_SZKLSZ03      -4.145e-01  5.949e-03   -69.666  < 2e-16 ***
ORIGIN_SZKLSZ04      -2.283e+00  1.187e-02  -192.327  < 2e-16 ***
ORIGIN_SZKLSZ05      -8.593e-01  8.272e-03  -103.882  < 2e-16 ***
ORIGIN_SZKLSZ06      -4.709e+00  1.857e-01   -25.352  < 2e-16 ***
ORIGIN_SZKLSZ07      -1.123e+00  8.408e-03  -133.615  < 2e-16 ***
ORIGIN_SZKLSZ08      -1.476e+00  9.152e-03  -161.321  < 2e-16 ***
ORIGIN_SZLKSZ01      -3.273e+00  3.875e-02   -84.465  < 2e-16 ***
ORIGIN_SZMDSZ01      -2.615e+00  2.802e-02   -93.303  < 2e-16 ***
ORIGIN_SZMDSZ02      -8.945e-01  1.035e-02   -86.389  < 2e-16 ***
ORIGIN_SZMDSZ03      -1.998e+00  1.703e-02  -117.297  < 2e-16 ***
ORIGIN_SZMPSZ01      -1.093e+00  8.367e-03  -130.656  < 2e-16 ***
ORIGIN_SZMPSZ02      -5.975e-01  6.898e-03   -86.616  < 2e-16 ***
ORIGIN_SZMPSZ03      -9.706e-03  5.319e-03    -1.825  0.06804 .  
ORIGIN_SZMUSZ02      -3.923e+00  1.038e-01   -37.806  < 2e-16 ***
ORIGIN_SZNTSZ01      -2.829e+00  3.529e-02   -80.157  < 2e-16 ***
ORIGIN_SZNTSZ02      -3.256e+00  2.323e-02  -140.180  < 2e-16 ***
ORIGIN_SZNTSZ03      -9.865e-01  7.777e-03  -126.848  < 2e-16 ***
ORIGIN_SZNTSZ05      -3.353e+00  4.964e-02   -67.546  < 2e-16 ***
ORIGIN_SZNTSZ06      -3.818e+00  5.576e-02   -68.483  < 2e-16 ***
ORIGIN_SZNVSZ01       4.449e-01  4.482e-03    99.269  < 2e-16 ***
ORIGIN_SZNVSZ02      -6.279e-01  6.470e-03   -97.044  < 2e-16 ***
ORIGIN_SZNVSZ03      -1.212e+00  7.788e-03  -155.644  < 2e-16 ***
ORIGIN_SZNVSZ04      -1.469e+00  9.091e-03  -161.543  < 2e-16 ***
ORIGIN_SZNVSZ05      -2.628e+00  1.579e-02  -166.466  < 2e-16 ***
ORIGIN_SZPGSZ01      -9.541e-01  1.223e-02   -78.035  < 2e-16 ***
ORIGIN_SZPGSZ02      -5.353e-01  7.233e-03   -74.009  < 2e-16 ***
ORIGIN_SZPGSZ03       9.574e-01  4.437e-03   215.779  < 2e-16 ***
ORIGIN_SZPGSZ04       1.110e+00  4.417e-03   251.169  < 2e-16 ***
ORIGIN_SZPGSZ05       2.658e-01  5.758e-03    46.156  < 2e-16 ***
ORIGIN_SZPLSZ01      -8.153e-01  1.044e-02   -78.119  < 2e-16 ***
ORIGIN_SZPLSZ02      -1.675e+00  1.478e-02  -113.340  < 2e-16 ***
ORIGIN_SZPLSZ03      -2.963e+00  3.672e-02   -80.686  < 2e-16 ***
ORIGIN_SZPLSZ04      -3.279e+00  3.684e-02   -89.012  < 2e-16 ***
ORIGIN_SZPLSZ05      -2.466e+00  2.245e-02  -109.864  < 2e-16 ***
ORIGIN_SZPNSZ01       1.411e+00  4.584e-03   307.690  < 2e-16 ***
ORIGIN_SZPNSZ02      -5.043e-01  1.108e-02   -45.503  < 2e-16 ***
ORIGIN_SZPNSZ03      -1.878e+00  1.940e-02   -96.796  < 2e-16 ***
ORIGIN_SZPNSZ04      -2.761e+00  3.112e-02   -88.706  < 2e-16 ***
ORIGIN_SZPNSZ05      -2.277e+00  2.628e-02   -86.662  < 2e-16 ***
ORIGIN_SZPRSZ01      -7.934e-01  1.142e-02   -69.499  < 2e-16 ***
ORIGIN_SZPRSZ02       9.414e-01  4.615e-03   203.981  < 2e-16 ***
ORIGIN_SZPRSZ03       7.674e-01  4.626e-03   165.881  < 2e-16 ***
ORIGIN_SZPRSZ04      -3.771e-01  7.516e-03   -50.168  < 2e-16 ***
ORIGIN_SZPRSZ05       1.327e+00  4.325e-03   306.737  < 2e-16 ***
ORIGIN_SZPRSZ06      -4.081e-01  8.651e-03   -47.172  < 2e-16 ***
ORIGIN_SZPRSZ07      -2.151e+00  1.610e-02  -133.558  < 2e-16 ***
ORIGIN_SZPRSZ08       5.293e-04  6.383e-03     0.083  0.93391    
ORIGIN_SZQTSZ01      -4.144e-01  6.846e-03   -60.539  < 2e-16 ***
ORIGIN_SZQTSZ02      -7.967e-01  6.327e-03  -125.933  < 2e-16 ***
ORIGIN_SZQTSZ03      -2.415e-01  5.681e-03   -42.509  < 2e-16 ***
ORIGIN_SZQTSZ04      -1.013e+00  7.129e-03  -142.123  < 2e-16 ***
ORIGIN_SZQTSZ05      -3.923e-01  5.994e-03   -65.446  < 2e-16 ***
ORIGIN_SZQTSZ06      -5.662e-01  6.481e-03   -87.359  < 2e-16 ***
ORIGIN_SZQTSZ07      -1.558e+00  9.635e-03  -161.662  < 2e-16 ***
ORIGIN_SZQTSZ08      -1.577e-01  5.699e-03   -27.665  < 2e-16 ***
ORIGIN_SZQTSZ09      -6.189e-01  6.633e-03   -93.312  < 2e-16 ***
ORIGIN_SZQTSZ10      -4.511e-01  6.512e-03   -69.271  < 2e-16 ***
ORIGIN_SZQTSZ11      -1.455e+00  9.800e-03  -148.421  < 2e-16 ***
ORIGIN_SZQTSZ12      -1.475e+00  1.044e-02  -141.309  < 2e-16 ***
ORIGIN_SZQTSZ13      -3.529e-01  6.413e-03   -55.038  < 2e-16 ***
ORIGIN_SZQTSZ14      -1.591e+00  9.847e-03  -161.565  < 2e-16 ***
ORIGIN_SZQTSZ15      -8.955e-01  1.027e-02   -87.184  < 2e-16 ***
ORIGIN_SZRCSZ01      -1.375e+00  1.265e-02  -108.704  < 2e-16 ***
ORIGIN_SZRCSZ06      -6.196e-01  8.475e-03   -73.116  < 2e-16 ***
ORIGIN_SZRVSZ01      -3.523e+00  3.237e-02  -108.818  < 2e-16 ***
ORIGIN_SZRVSZ02      -2.912e+00  2.776e-02  -104.868  < 2e-16 ***
ORIGIN_SZRVSZ03      -3.145e+00  2.379e-02  -132.232  < 2e-16 ***
ORIGIN_SZRVSZ04      -3.357e+00  5.567e-02   -60.309  < 2e-16 ***
ORIGIN_SZRVSZ05      -2.438e+00  1.644e-02  -148.272  < 2e-16 ***
ORIGIN_SZSBSZ01       5.890e-01  5.529e-03   106.520  < 2e-16 ***
ORIGIN_SZSBSZ02      -7.098e-01  8.213e-03   -86.432  < 2e-16 ***
ORIGIN_SZSBSZ03       9.634e-01  4.611e-03   208.943  < 2e-16 ***
ORIGIN_SZSBSZ04       7.729e-01  5.289e-03   146.136  < 2e-16 ***
ORIGIN_SZSBSZ05      -9.966e-02  6.543e-03   -15.231  < 2e-16 ***
ORIGIN_SZSBSZ06      -1.778e+00  1.719e-02  -103.427  < 2e-16 ***
ORIGIN_SZSBSZ07      -1.161e+00  1.256e-02   -92.436  < 2e-16 ***
ORIGIN_SZSBSZ08      -1.212e+00  1.222e-02   -99.227  < 2e-16 ***
ORIGIN_SZSBSZ09      -5.783e-01  8.579e-03   -67.412  < 2e-16 ***
ORIGIN_SZSESZ02       9.999e-01  4.409e-03   226.798  < 2e-16 ***
ORIGIN_SZSESZ03       1.214e+00  4.164e-03   291.675  < 2e-16 ***
ORIGIN_SZSESZ04       8.141e-01  4.868e-03   167.238  < 2e-16 ***
ORIGIN_SZSESZ05      -2.186e-01  5.915e-03   -36.961  < 2e-16 ***
ORIGIN_SZSESZ06       7.298e-01  4.689e-03   155.641  < 2e-16 ***
ORIGIN_SZSESZ07      -2.543e+00  1.961e-02  -129.689  < 2e-16 ***
ORIGIN_SZSGSZ01      -1.016e+00  8.550e-03  -118.869  < 2e-16 ***
ORIGIN_SZSGSZ02      -1.120e+00  9.589e-03  -116.799  < 2e-16 ***
ORIGIN_SZSGSZ03       2.169e-01  5.167e-03    41.970  < 2e-16 ***
ORIGIN_SZSGSZ04       2.672e-01  4.792e-03    55.757  < 2e-16 ***
ORIGIN_SZSGSZ05      -1.785e+00  1.060e-02  -168.456  < 2e-16 ***
ORIGIN_SZSGSZ06       4.017e-01  4.541e-03    88.470  < 2e-16 ***
ORIGIN_SZSGSZ07      -6.303e-01  6.235e-03  -101.098  < 2e-16 ***
ORIGIN_SZSKSZ01      -1.928e-01  7.765e-03   -24.826  < 2e-16 ***
ORIGIN_SZSKSZ02       3.870e-01  5.689e-03    68.026  < 2e-16 ***
ORIGIN_SZSKSZ03      -6.815e-01  7.983e-03   -85.369  < 2e-16 ***
ORIGIN_SZSKSZ04      -2.528e+00  2.702e-02   -93.548  < 2e-16 ***
ORIGIN_SZSKSZ05      -1.370e+00  1.552e-02   -88.311  < 2e-16 ***
ORIGIN_SZSLSZ01      -3.218e+00  3.058e-02  -105.238  < 2e-16 ***
ORIGIN_SZSLSZ04      -6.800e-01  7.683e-03   -88.497  < 2e-16 ***
ORIGIN_SZSRSZ01      -2.389e+00  1.583e-02  -150.989  < 2e-16 ***
ORIGIN_SZTHSZ01      -2.183e+00  4.887e-02   -44.666  < 2e-16 ***
ORIGIN_SZTHSZ03      -2.243e+00  2.243e-02  -100.025  < 2e-16 ***
ORIGIN_SZTHSZ04      -2.005e+00  2.869e-02   -69.879  < 2e-16 ***
ORIGIN_SZTHSZ06      -2.276e+00  1.784e-02  -127.557  < 2e-16 ***
ORIGIN_SZTMSZ01       4.015e-01  5.814e-03    69.048  < 2e-16 ***
ORIGIN_SZTMSZ02       2.222e+00  3.795e-03   585.568  < 2e-16 ***
ORIGIN_SZTMSZ03       1.412e+00  4.108e-03   343.608  < 2e-16 ***
ORIGIN_SZTMSZ04       9.106e-01  4.742e-03   192.036  < 2e-16 ***
ORIGIN_SZTMSZ05      -3.259e-01  7.534e-03   -43.253  < 2e-16 ***
ORIGIN_SZTNSZ01      -1.806e+00  1.038e-02  -174.076  < 2e-16 ***
ORIGIN_SZTNSZ02      -1.741e+00  9.778e-03  -178.108  < 2e-16 ***
ORIGIN_SZTNSZ03      -2.277e+00  1.338e-02  -170.199  < 2e-16 ***
ORIGIN_SZTNSZ04      -7.703e-01  7.197e-03  -107.032  < 2e-16 ***
ORIGIN_SZTPSZ01      -6.466e-01  6.287e-03  -102.841  < 2e-16 ***
ORIGIN_SZTPSZ02       4.633e-01  4.347e-03   106.578  < 2e-16 ***
ORIGIN_SZTPSZ03      -5.186e-01  6.085e-03   -85.234  < 2e-16 ***
ORIGIN_SZTPSZ04      -2.900e-01  5.779e-03   -50.190  < 2e-16 ***
ORIGIN_SZTPSZ05      -2.169e-01  6.072e-03   -35.720  < 2e-16 ***
ORIGIN_SZTPSZ06       3.357e-01  5.942e-03    56.486  < 2e-16 ***
ORIGIN_SZTPSZ07      -2.517e-01  6.317e-03   -39.846  < 2e-16 ***
ORIGIN_SZTPSZ08      -1.075e+00  9.109e-03  -118.034  < 2e-16 ***
ORIGIN_SZTPSZ09      -3.708e-01  6.189e-03   -59.903  < 2e-16 ***
ORIGIN_SZTPSZ10      -6.889e-01  7.634e-03   -90.229  < 2e-16 ***
ORIGIN_SZTPSZ11       7.661e-02  5.459e-03    14.033  < 2e-16 ***
ORIGIN_SZTPSZ12      -5.971e-01  6.522e-03   -91.552  < 2e-16 ***
ORIGIN_SZTSSZ01      -3.517e+00  4.739e-02   -74.210  < 2e-16 ***
ORIGIN_SZTSSZ02       3.022e-01  7.334e-03    41.203  < 2e-16 ***
ORIGIN_SZTSSZ03       3.730e-01  7.073e-03    52.733  < 2e-16 ***
ORIGIN_SZTSSZ04       3.610e-01  7.463e-03    48.372  < 2e-16 ***
ORIGIN_SZTSSZ05      -1.103e+00  1.404e-02   -78.566  < 2e-16 ***
ORIGIN_SZTSSZ06      -1.310e+00  1.718e-02   -76.286  < 2e-16 ***
ORIGIN_SZWCSZ01      -1.233e-01  7.861e-03   -15.690  < 2e-16 ***
ORIGIN_SZWCSZ02      -2.872e+00  3.159e-02   -90.911  < 2e-16 ***
ORIGIN_SZWCSZ03      -4.138e+00  1.241e-01   -33.349  < 2e-16 ***
ORIGIN_SZWDSZ01       1.370e+00  4.146e-03   330.448  < 2e-16 ***
ORIGIN_SZWDSZ02       1.041e+00  4.747e-03   219.219  < 2e-16 ***
ORIGIN_SZWDSZ03       2.189e+00  4.035e-03   542.344  < 2e-16 ***
ORIGIN_SZWDSZ04       1.142e+00  4.963e-03   230.074  < 2e-16 ***
ORIGIN_SZWDSZ05       5.160e-01  4.998e-03   103.230  < 2e-16 ***
ORIGIN_SZWDSZ06       1.208e+00  4.611e-03   262.019  < 2e-16 ***
ORIGIN_SZWDSZ07      -3.805e-01  8.034e-03   -47.365  < 2e-16 ***
ORIGIN_SZWDSZ08      -4.839e-01  7.878e-03   -61.426  < 2e-16 ***
ORIGIN_SZWDSZ09       1.475e+00  4.401e-03   335.097  < 2e-16 ***
ORIGIN_SZYSSZ01      -1.552e-01  5.643e-03   -27.496  < 2e-16 ***
ORIGIN_SZYSSZ02       8.958e-01  4.973e-03   180.144  < 2e-16 ***
ORIGIN_SZYSSZ03       1.757e+00  4.275e-03   411.050  < 2e-16 ***
ORIGIN_SZYSSZ04       8.439e-01  4.538e-03   185.955  < 2e-16 ***
ORIGIN_SZYSSZ05      -9.995e-02  5.920e-03   -16.884  < 2e-16 ***
ORIGIN_SZYSSZ06      -1.175e+00  1.079e-02  -108.835  < 2e-16 ***
ORIGIN_SZYSSZ07      -1.202e+00  1.127e-02  -106.642  < 2e-16 ***
ORIGIN_SZYSSZ08       1.244e-02  6.104e-03     2.039  0.04148 *  
ORIGIN_SZYSSZ09       1.385e+00  4.239e-03   326.757  < 2e-16 ***
log(DESTIN_AGE25_64)  2.298e-02  8.832e-05   260.146  < 2e-16 ***
log(dist)            -6.947e-01  1.295e-04 -5363.438  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 60796037  on 14733  degrees of freedom
Residual deviance: 26726668  on 14453  degrees of freedom
AIC: 26818857

Number of Fisher Scoring iterations: 7

We can also examine the R-squared using the function we prepared

CalcRSquared(orcSIM$data$TRIPS, orcSIM$fitted.values)
[1] 0.4165837

Destination Constrained SIM

The following code chunk fits a destination constrained model

decSIM <- glm(formula = TRIPS ~ 
                DESTIN_SZ + 
                log(ORIGIN_AGE25_64) + 
                log(dist),
              family = poisson(link = "log"),
              data = SIM_data,
              na.action = na.exclude)
summary(decSIM)

Call:
glm(formula = TRIPS ~ DESTIN_SZ + log(ORIGIN_AGE25_64) + log(dist), 
    family = poisson(link = "log"), data = SIM_data, na.action = na.exclude)

Coefficients:
                       Estimate Std. Error   z value Pr(>|z|)    
(Intercept)          10.8110189  0.0033476  3229.499  < 2e-16 ***
DESTIN_SZAMSZ02       0.1775885  0.0041530    42.761  < 2e-16 ***
DESTIN_SZAMSZ03       0.2064091  0.0040888    50.482  < 2e-16 ***
DESTIN_SZAMSZ04      -0.9406455  0.0060637  -155.127  < 2e-16 ***
DESTIN_SZAMSZ05      -1.1578100  0.0061804  -187.337  < 2e-16 ***
DESTIN_SZAMSZ06      -0.8861493  0.0059241  -149.584  < 2e-16 ***
DESTIN_SZAMSZ07      -1.7712447  0.0096070  -184.370  < 2e-16 ***
DESTIN_SZAMSZ08      -1.0707197  0.0067763  -158.009  < 2e-16 ***
DESTIN_SZAMSZ09      -0.9682250  0.0060435  -160.210  < 2e-16 ***
DESTIN_SZAMSZ10       0.2612773  0.0043738    59.737  < 2e-16 ***
DESTIN_SZAMSZ11      -0.3714704  0.0086200   -43.094  < 2e-16 ***
DESTIN_SZAMSZ12       0.0250455  0.0049850     5.024 5.06e-07 ***
DESTIN_SZBDSZ01       0.5154763  0.0037827   136.271  < 2e-16 ***
DESTIN_SZBDSZ02      -0.2843120  0.0049517   -57.417  < 2e-16 ***
DESTIN_SZBDSZ03      -0.0134646  0.0042692    -3.154  0.00161 ** 
DESTIN_SZBDSZ04       1.0014441  0.0034463   290.582  < 2e-16 ***
DESTIN_SZBDSZ05       0.3721573  0.0038992    95.445  < 2e-16 ***
DESTIN_SZBDSZ06       0.2013935  0.0042182    47.744  < 2e-16 ***
DESTIN_SZBDSZ07      -1.0642612  0.0092942  -114.508  < 2e-16 ***
DESTIN_SZBDSZ08      -1.7769370  0.0105721  -168.077  < 2e-16 ***
DESTIN_SZBKSZ01      -1.1944766  0.0065580  -182.141  < 2e-16 ***
DESTIN_SZBKSZ02      -0.2604946  0.0052044   -50.053  < 2e-16 ***
DESTIN_SZBKSZ03      -0.5905775  0.0055618  -106.184  < 2e-16 ***
DESTIN_SZBKSZ04      -0.0521573  0.0048274   -10.804  < 2e-16 ***
DESTIN_SZBKSZ05      -0.8258599  0.0057094  -144.650  < 2e-16 ***
DESTIN_SZBKSZ06      -0.8696763  0.0060934  -142.725  < 2e-16 ***
DESTIN_SZBKSZ07       0.2216292  0.0040334    54.949  < 2e-16 ***
DESTIN_SZBKSZ08      -1.1179375  0.0068749  -162.612  < 2e-16 ***
DESTIN_SZBKSZ09      -0.2888733  0.0049056   -58.886  < 2e-16 ***
DESTIN_SZBLSZ01      -0.4487061  0.0070226   -63.894  < 2e-16 ***
DESTIN_SZBLSZ02       0.6343096  0.0065174    97.326  < 2e-16 ***
DESTIN_SZBLSZ03       1.3492337  0.0074135   181.997  < 2e-16 ***
DESTIN_SZBLSZ04      -0.0339193  0.0131568    -2.578  0.00993 ** 
DESTIN_SZBMSZ01      -0.3497912  0.0046910   -74.567  < 2e-16 ***
DESTIN_SZBMSZ02      -0.5995634  0.0048828  -122.792  < 2e-16 ***
DESTIN_SZBMSZ03      -0.8726401  0.0056851  -153.495  < 2e-16 ***
DESTIN_SZBMSZ04      -0.5350402  0.0048888  -109.442  < 2e-16 ***
DESTIN_SZBMSZ05      -0.4981814  0.0065971   -75.515  < 2e-16 ***
DESTIN_SZBMSZ06      -2.0640198  0.0123050  -167.739  < 2e-16 ***
DESTIN_SZBMSZ07      -0.3100988  0.0045283   -68.480  < 2e-16 ***
DESTIN_SZBMSZ08      -1.2748152  0.0062622  -203.573  < 2e-16 ***
DESTIN_SZBMSZ09      -2.8056325  0.0143532  -195.471  < 2e-16 ***
DESTIN_SZBMSZ10      -1.9166407  0.0089273  -214.693  < 2e-16 ***
DESTIN_SZBMSZ11      -1.7261160  0.0079281  -217.722  < 2e-16 ***
DESTIN_SZBMSZ12      -1.1495908  0.0077721  -147.912  < 2e-16 ***
DESTIN_SZBMSZ13      -0.5428008  0.0050824  -106.799  < 2e-16 ***
DESTIN_SZBMSZ14      -1.1422302  0.0076325  -149.653  < 2e-16 ***
DESTIN_SZBMSZ15      -1.2217517  0.0068685  -177.878  < 2e-16 ***
DESTIN_SZBMSZ16      -2.4074288  0.0107900  -223.116  < 2e-16 ***
DESTIN_SZBMSZ17      -2.6985491  0.0164771  -163.776  < 2e-16 ***
DESTIN_SZBPSZ01      -0.6183085  0.0054605  -113.233  < 2e-16 ***
DESTIN_SZBPSZ02      -1.4579175  0.0083271  -175.080  < 2e-16 ***
DESTIN_SZBPSZ03      -1.0775392  0.0075109  -143.463  < 2e-16 ***
DESTIN_SZBPSZ04      -0.6645303  0.0058070  -114.436  < 2e-16 ***
DESTIN_SZBPSZ05       0.3449386  0.0039504    87.318  < 2e-16 ***
DESTIN_SZBPSZ06      -0.9360064  0.0077394  -120.941  < 2e-16 ***
DESTIN_SZBPSZ07      -0.6850065  0.0077761   -88.091  < 2e-16 ***
DESTIN_SZBSSZ01      -0.3144210  0.0045803   -68.647  < 2e-16 ***
DESTIN_SZBSSZ02      -0.7531935  0.0051075  -147.469  < 2e-16 ***
DESTIN_SZBSSZ03       0.1964072  0.0038255    51.342  < 2e-16 ***
DESTIN_SZBTSZ01       0.0749897  0.0041584    18.033  < 2e-16 ***
DESTIN_SZBTSZ02      -0.8214254  0.0065659  -125.105  < 2e-16 ***
DESTIN_SZBTSZ03      -0.1672596  0.0047942   -34.888  < 2e-16 ***
DESTIN_SZBTSZ04      -1.7727273  0.0103706  -170.938  < 2e-16 ***
DESTIN_SZBTSZ05      -0.8162630  0.0067401  -121.105  < 2e-16 ***
DESTIN_SZBTSZ06      -0.8159130  0.0059754  -136.546  < 2e-16 ***
DESTIN_SZBTSZ07      -2.1139258  0.0105602  -200.178  < 2e-16 ***
DESTIN_SZBTSZ08      -1.3565179  0.0086828  -156.231  < 2e-16 ***
DESTIN_SZCBSZ01      -4.6643129  0.3162417   -14.749  < 2e-16 ***
DESTIN_SZCCSZ01      -1.0088833  0.0080155  -125.866  < 2e-16 ***
DESTIN_SZCHSZ01      -1.1909317  0.0095262  -125.017  < 2e-16 ***
DESTIN_SZCHSZ02       0.0890035  0.0052277    17.025  < 2e-16 ***
DESTIN_SZCHSZ03       1.4883985  0.0039094   380.724  < 2e-16 ***
DESTIN_SZCKSZ01      -0.1684738  0.0047561   -35.422  < 2e-16 ***
DESTIN_SZCKSZ02      -0.4314614  0.0051537   -83.720  < 2e-16 ***
DESTIN_SZCKSZ03       0.6413457  0.0038639   165.983  < 2e-16 ***
DESTIN_SZCKSZ04      -0.6370791  0.0059869  -106.412  < 2e-16 ***
DESTIN_SZCKSZ05      -0.4185112  0.0065348   -64.044  < 2e-16 ***
DESTIN_SZCKSZ06       0.7003888  0.0045139   155.163  < 2e-16 ***
DESTIN_SZCLSZ01       0.3751343  0.0047400    79.143  < 2e-16 ***
DESTIN_SZCLSZ02      -2.2913668  0.0133371  -171.804  < 2e-16 ***
DESTIN_SZCLSZ03      -1.0498490  0.0076548  -137.149  < 2e-16 ***
DESTIN_SZCLSZ04      -0.1118915  0.0044886   -24.928  < 2e-16 ***
DESTIN_SZCLSZ05      -1.3113032  0.0084067  -155.983  < 2e-16 ***
DESTIN_SZCLSZ06       0.1661786  0.0040203    41.334  < 2e-16 ***
DESTIN_SZCLSZ07      -0.6429895  0.0052617  -122.202  < 2e-16 ***
DESTIN_SZCLSZ08      -0.4271702  0.0057208   -74.670  < 2e-16 ***
DESTIN_SZCLSZ09       0.3882136  0.0063758    60.888  < 2e-16 ***
DESTIN_SZDTSZ02      -3.0106480  0.0348374   -86.420  < 2e-16 ***
DESTIN_SZDTSZ03      -1.4195712  0.0144110   -98.506  < 2e-16 ***
DESTIN_SZDTSZ13      -2.2368573  0.0161427  -138.567  < 2e-16 ***
DESTIN_SZGLSZ01       0.0013721  0.0051224     0.268  0.78881    
DESTIN_SZGLSZ02      -0.3376674  0.0046195   -73.097  < 2e-16 ***
DESTIN_SZGLSZ03       0.3659900  0.0038384    95.350  < 2e-16 ***
DESTIN_SZGLSZ04       0.2969928  0.0038026    78.103  < 2e-16 ***
DESTIN_SZGLSZ05       0.1786445  0.0038853    45.980  < 2e-16 ***
DESTIN_SZHGSZ01       0.2979206  0.0038825    76.735  < 2e-16 ***
DESTIN_SZHGSZ02      -0.5701034  0.0051182  -111.388  < 2e-16 ***
DESTIN_SZHGSZ03      -1.0387610  0.0061020  -170.233  < 2e-16 ***
DESTIN_SZHGSZ04      -0.2264881  0.0043617   -51.926  < 2e-16 ***
DESTIN_SZHGSZ05      -0.2287090  0.0044851   -50.993  < 2e-16 ***
DESTIN_SZHGSZ06      -0.7896437  0.0054081  -146.010  < 2e-16 ***
DESTIN_SZHGSZ07       0.2268880  0.0040336    56.249  < 2e-16 ***
DESTIN_SZHGSZ08      -0.4260784  0.0048967   -87.013  < 2e-16 ***
DESTIN_SZHGSZ09       0.1027784  0.0051341    20.019  < 2e-16 ***
DESTIN_SZHGSZ10      -2.8571803  0.0262064  -109.026  < 2e-16 ***
DESTIN_SZJESZ01      -0.0843635  0.0048222   -17.495  < 2e-16 ***
DESTIN_SZJESZ02      -0.5197682  0.0051511  -100.904  < 2e-16 ***
DESTIN_SZJESZ03      -0.6250311  0.0056619  -110.392  < 2e-16 ***
DESTIN_SZJESZ04      -0.3937360  0.0065536   -60.080  < 2e-16 ***
DESTIN_SZJESZ05      -0.9748291  0.0097665   -99.814  < 2e-16 ***
DESTIN_SZJESZ06       0.3642736  0.0040600    89.722  < 2e-16 ***
DESTIN_SZJESZ07      -1.1571882  0.0081557  -141.887  < 2e-16 ***
DESTIN_SZJESZ08      -0.5955747  0.0078071   -76.286  < 2e-16 ***
DESTIN_SZJESZ09      -0.3629500  0.0053966   -67.256  < 2e-16 ***
DESTIN_SZJESZ10       0.7691552  0.0069348   110.912  < 2e-16 ***
DESTIN_SZJESZ11       0.9365743  0.0065801   142.335  < 2e-16 ***
DESTIN_SZJWSZ01      -0.4568805  0.0064536   -70.795  < 2e-16 ***
DESTIN_SZJWSZ02      -0.2880426  0.0051632   -55.788  < 2e-16 ***
DESTIN_SZJWSZ03       0.6680404  0.0039264   170.142  < 2e-16 ***
DESTIN_SZJWSZ04       0.9492158  0.0037186   255.262  < 2e-16 ***
DESTIN_SZJWSZ05      -0.1938053  0.0060810   -31.871  < 2e-16 ***
DESTIN_SZJWSZ06       0.3813164  0.0054551    69.900  < 2e-16 ***
DESTIN_SZJWSZ07      -1.2676010  0.0280038   -45.265  < 2e-16 ***
DESTIN_SZJWSZ08       0.5013149  0.0044573   112.471  < 2e-16 ***
DESTIN_SZJWSZ09       1.4161404  0.0033937   417.291  < 2e-16 ***
DESTIN_SZKLSZ01      -0.6909444  0.0051540  -134.059  < 2e-16 ***
DESTIN_SZKLSZ02      -0.8146023  0.0057129  -142.589  < 2e-16 ***
DESTIN_SZKLSZ03      -1.3956114  0.0065167  -214.161  < 2e-16 ***
DESTIN_SZKLSZ04      -1.9070281  0.0087370  -218.270  < 2e-16 ***
DESTIN_SZKLSZ05      -0.9293576  0.0071070  -130.766  < 2e-16 ***
DESTIN_SZKLSZ06      -2.5402234  0.0362062   -70.160  < 2e-16 ***
DESTIN_SZKLSZ07      -1.2017213  0.0065751  -182.769  < 2e-16 ***
DESTIN_SZKLSZ08      -0.6083433  0.0050916  -119.480  < 2e-16 ***
DESTIN_SZLKSZ01      -1.5186810  0.0204155   -74.389  < 2e-16 ***
DESTIN_SZMDSZ01      -1.4601772  0.0198347   -73.617  < 2e-16 ***
DESTIN_SZMDSZ02      -1.1554609  0.0111345  -103.773  < 2e-16 ***
DESTIN_SZMDSZ03      -2.9919337  0.0250838  -119.277  < 2e-16 ***
DESTIN_SZMPSZ01      -1.1705809  0.0077128  -151.771  < 2e-16 ***
DESTIN_SZMPSZ02      -0.9380957  0.0060321  -155.517  < 2e-16 ***
DESTIN_SZMPSZ03      -0.1761013  0.0046389   -37.962  < 2e-16 ***
DESTIN_SZMUSZ02      -2.4525115  0.0199630  -122.853  < 2e-16 ***
DESTIN_SZNTSZ01      -3.6605524  0.0447752   -81.754  < 2e-16 ***
DESTIN_SZNTSZ02      -2.0082021  0.0108736  -184.686  < 2e-16 ***
DESTIN_SZNTSZ03      -1.2387489  0.0076141  -162.691  < 2e-16 ***
DESTIN_SZNTSZ05      -1.8054361  0.0249540   -72.351  < 2e-16 ***
DESTIN_SZNTSZ06      -2.9500517  0.0428601   -68.830  < 2e-16 ***
DESTIN_SZNVSZ01      -0.4089022  0.0044288   -92.327  < 2e-16 ***
DESTIN_SZNVSZ02      -0.6865452  0.0052770  -130.102  < 2e-16 ***
DESTIN_SZNVSZ03      -0.7333670  0.0054243  -135.199  < 2e-16 ***
DESTIN_SZNVSZ04      -2.2095097  0.0106997  -206.503  < 2e-16 ***
DESTIN_SZNVSZ05      -1.8721104  0.0089058  -210.212  < 2e-16 ***
DESTIN_SZPGSZ01      -1.8756618  0.0153008  -122.586  < 2e-16 ***
DESTIN_SZPGSZ02      -0.9435337  0.0067224  -140.356  < 2e-16 ***
DESTIN_SZPGSZ03       0.3458476  0.0040152    86.134  < 2e-16 ***
DESTIN_SZPGSZ04      -0.0271485  0.0044805    -6.059 1.37e-09 ***
DESTIN_SZPGSZ05      -0.8920273  0.0070730  -126.117  < 2e-16 ***
DESTIN_SZPLSZ01      -0.2153087  0.0068270   -31.538  < 2e-16 ***
DESTIN_SZPLSZ02      -1.3646116  0.0131155  -104.046  < 2e-16 ***
DESTIN_SZPLSZ03      -0.0869245  0.0095838    -9.070  < 2e-16 ***
DESTIN_SZPLSZ04      -0.2574560  0.0093336   -27.584  < 2e-16 ***
DESTIN_SZPLSZ05      -0.7186364  0.0116835   -61.509  < 2e-16 ***
DESTIN_SZPNSZ01       1.1326963  0.0049977   226.643  < 2e-16 ***
DESTIN_SZPNSZ02       1.6516855  0.0064492   256.106  < 2e-16 ***
DESTIN_SZPNSZ03       0.8504093  0.0077034   110.394  < 2e-16 ***
DESTIN_SZPNSZ04       1.6891381  0.0075802   222.836  < 2e-16 ***
DESTIN_SZPNSZ05       0.7402750  0.0115948    63.845  < 2e-16 ***
DESTIN_SZPRSZ01      -1.0257636  0.0084652  -121.175  < 2e-16 ***
DESTIN_SZPRSZ02      -0.2028503  0.0049839   -40.701  < 2e-16 ***
DESTIN_SZPRSZ03       0.5560483  0.0038496   144.442  < 2e-16 ***
DESTIN_SZPRSZ04      -0.6824142  0.0079047   -86.330  < 2e-16 ***
DESTIN_SZPRSZ05       0.0316117  0.0044946     7.033 2.02e-12 ***
DESTIN_SZPRSZ06       0.3706283  0.0052006    71.267  < 2e-16 ***
DESTIN_SZPRSZ07      -1.4740460  0.0117304  -125.661  < 2e-16 ***
DESTIN_SZPRSZ08      -0.7869180  0.0064862  -121.321  < 2e-16 ***
DESTIN_SZQTSZ01      -1.2790095  0.0085392  -149.781  < 2e-16 ***
DESTIN_SZQTSZ02      -1.4989188  0.0073423  -204.149  < 2e-16 ***
DESTIN_SZQTSZ03      -0.9334132  0.0064035  -145.765  < 2e-16 ***
DESTIN_SZQTSZ04      -1.0506142  0.0065335  -160.805  < 2e-16 ***
DESTIN_SZQTSZ05      -0.9765013  0.0058471  -167.006  < 2e-16 ***
DESTIN_SZQTSZ06      -1.2206088  0.0063560  -192.042  < 2e-16 ***
DESTIN_SZQTSZ07      -1.6794007  0.0108727  -154.460  < 2e-16 ***
DESTIN_SZQTSZ08      -0.1214413  0.0047980   -25.311  < 2e-16 ***
DESTIN_SZQTSZ09      -0.5252607  0.0057371   -91.555  < 2e-16 ***
DESTIN_SZQTSZ10      -0.5981644  0.0054192  -110.378  < 2e-16 ***
DESTIN_SZQTSZ11      -0.0766021  0.0053446   -14.333  < 2e-16 ***
DESTIN_SZQTSZ12      -0.6153017  0.0070680   -87.054  < 2e-16 ***
DESTIN_SZQTSZ13      -0.1690535  0.0051315   -32.944  < 2e-16 ***
DESTIN_SZQTSZ14      -0.5398362  0.0062233   -86.744  < 2e-16 ***
DESTIN_SZQTSZ15      -0.1873015  0.0073132   -25.611  < 2e-16 ***
DESTIN_SZRCSZ01      -0.5875494  0.0071798   -81.833  < 2e-16 ***
DESTIN_SZRCSZ06      -2.0856090  0.0188789  -110.473  < 2e-16 ***
DESTIN_SZRVSZ01      -2.6183708  0.0162319  -161.310  < 2e-16 ***
DESTIN_SZRVSZ02      -3.1882190  0.0326141   -97.756  < 2e-16 ***
DESTIN_SZRVSZ03      -2.5981974  0.0135074  -192.353  < 2e-16 ***
DESTIN_SZRVSZ04      -1.9741504  0.0154961  -127.396  < 2e-16 ***
DESTIN_SZRVSZ05      -3.1547734  0.0256310  -123.084  < 2e-16 ***
DESTIN_SZSBSZ01      -0.3097949  0.0060601   -51.121  < 2e-16 ***
DESTIN_SZSBSZ02      -1.1229132  0.0076338  -147.097  < 2e-16 ***
DESTIN_SZSBSZ03       0.6289715  0.0041400   151.926  < 2e-16 ***
DESTIN_SZSBSZ04       0.1419430  0.0051357    27.638  < 2e-16 ***
DESTIN_SZSBSZ05      -0.9256413  0.0071963  -128.628  < 2e-16 ***
DESTIN_SZSBSZ06      -2.3487368  0.0221611  -105.984  < 2e-16 ***
DESTIN_SZSBSZ07      -0.7864630  0.0181706   -43.282  < 2e-16 ***
DESTIN_SZSBSZ08       1.3240051  0.0051598   256.599  < 2e-16 ***
DESTIN_SZSBSZ09       0.8431156  0.0048330   174.449  < 2e-16 ***
DESTIN_SZSESZ02      -0.2385874  0.0046618   -51.180  < 2e-16 ***
DESTIN_SZSESZ03       0.5439188  0.0036932   147.276  < 2e-16 ***
DESTIN_SZSESZ04      -0.6715716  0.0054222  -123.856  < 2e-16 ***
DESTIN_SZSESZ05      -0.3601932  0.0047508   -75.818  < 2e-16 ***
DESTIN_SZSESZ06      -0.6088413  0.0057017  -106.782  < 2e-16 ***
DESTIN_SZSESZ07      -2.9477507  0.0226797  -129.973  < 2e-16 ***
DESTIN_SZSGSZ01      -0.5100640  0.0058280   -87.519  < 2e-16 ***
DESTIN_SZSGSZ02      -0.0439941  0.0051633    -8.520  < 2e-16 ***
DESTIN_SZSGSZ03      -0.3700648  0.0047152   -78.483  < 2e-16 ***
DESTIN_SZSGSZ04      -0.3021335  0.0046865   -64.468  < 2e-16 ***
DESTIN_SZSGSZ05      -2.2253287  0.0097908  -227.288  < 2e-16 ***
DESTIN_SZSGSZ06       0.2963602  0.0037948    78.097  < 2e-16 ***
DESTIN_SZSGSZ07      -0.5940373  0.0051371  -115.637  < 2e-16 ***
DESTIN_SZSISZ01      -1.4528976  0.0257790   -56.360  < 2e-16 ***
DESTIN_SZSKSZ01      -0.0374952  0.0066885    -5.606 2.07e-08 ***
DESTIN_SZSKSZ02       0.7271418  0.0050281   144.617  < 2e-16 ***
DESTIN_SZSKSZ03      -0.0640794  0.0059146   -10.834  < 2e-16 ***
DESTIN_SZSKSZ04      -0.5610767  0.0139676   -40.170  < 2e-16 ***
DESTIN_SZSKSZ05       0.1510974  0.0104871    14.408  < 2e-16 ***
DESTIN_SZSLSZ01      -0.5823031  0.0083356   -69.858  < 2e-16 ***
DESTIN_SZSLSZ04      -0.8166665  0.0070329  -116.122  < 2e-16 ***
DESTIN_SZSRSZ01      -2.3241796  0.0127215  -182.696  < 2e-16 ***
DESTIN_SZTHSZ01      -2.8157635  0.0366840   -76.757  < 2e-16 ***
DESTIN_SZTHSZ03      -2.1005978  0.0250842   -83.742  < 2e-16 ***
DESTIN_SZTHSZ04      -2.1246250  0.0213690   -99.425  < 2e-16 ***
DESTIN_SZTHSZ06      -1.4571092  0.0150031   -97.121  < 2e-16 ***
DESTIN_SZTMSZ01      -0.1234559  0.0055152   -22.385  < 2e-16 ***
DESTIN_SZTMSZ02       1.5961628  0.0032599   489.635  < 2e-16 ***
DESTIN_SZTMSZ03       0.6977233  0.0037138   187.875  < 2e-16 ***
DESTIN_SZTMSZ04       0.8606606  0.0037592   228.947  < 2e-16 ***
DESTIN_SZTMSZ05       0.3750655  0.0051281    73.140  < 2e-16 ***
DESTIN_SZTNSZ01      -1.2624562  0.0066979  -188.485  < 2e-16 ***
DESTIN_SZTNSZ02      -2.0761581  0.0096538  -215.062  < 2e-16 ***
DESTIN_SZTNSZ03      -2.1128125  0.0115717  -182.584  < 2e-16 ***
DESTIN_SZTNSZ04      -1.2417494  0.0068502  -181.271  < 2e-16 ***
DESTIN_SZTPSZ01      -0.7094356  0.0055768  -127.211  < 2e-16 ***
DESTIN_SZTPSZ02       0.1491604  0.0037260    40.032  < 2e-16 ***
DESTIN_SZTPSZ03      -0.4973355  0.0054878   -90.626  < 2e-16 ***
DESTIN_SZTPSZ04      -1.5160395  0.0071592  -211.761  < 2e-16 ***
DESTIN_SZTPSZ05      -0.9196565  0.0056750  -162.054  < 2e-16 ***
DESTIN_SZTPSZ06      -0.2710649  0.0062637   -43.276  < 2e-16 ***
DESTIN_SZTPSZ07      -2.0198681  0.0116556  -173.296  < 2e-16 ***
DESTIN_SZTPSZ08      -1.4881412  0.0085532  -173.987  < 2e-16 ***
DESTIN_SZTPSZ09      -0.5901273  0.0059394   -99.358  < 2e-16 ***
DESTIN_SZTPSZ10      -1.1215711  0.0084488  -132.749  < 2e-16 ***
DESTIN_SZTPSZ11      -0.4837089  0.0050905   -95.022  < 2e-16 ***
DESTIN_SZTPSZ12      -0.8653927  0.0061326  -141.113  < 2e-16 ***
DESTIN_SZTSSZ01      -0.5515103  0.0208541   -26.446  < 2e-16 ***
DESTIN_SZTSSZ02       0.8373778  0.0093757    89.314  < 2e-16 ***
DESTIN_SZTSSZ03       1.7021888  0.0064394   264.340  < 2e-16 ***
DESTIN_SZTSSZ04       1.5355016  0.0067855   226.292  < 2e-16 ***
DESTIN_SZTSSZ05       1.6932319  0.0073725   229.668  < 2e-16 ***
DESTIN_SZTSSZ06       0.4567808  0.0137927    33.118  < 2e-16 ***
DESTIN_SZWCSZ01       1.3967640  0.0045392   307.711  < 2e-16 ***
DESTIN_SZWCSZ02      -0.4560229  0.0122949   -37.090  < 2e-16 ***
DESTIN_SZWCSZ03      -2.0710051  0.0325121   -63.699  < 2e-16 ***
DESTIN_SZWDSZ01       1.5137342  0.0034774   435.310  < 2e-16 ***
DESTIN_SZWDSZ02      -0.3005475  0.0055149   -54.497  < 2e-16 ***
DESTIN_SZWDSZ03       1.2514543  0.0036112   346.550  < 2e-16 ***
DESTIN_SZWDSZ04      -0.1702528  0.0058295   -29.205  < 2e-16 ***
DESTIN_SZWDSZ05      -0.0005419  0.0053911    -0.101  0.91994    
DESTIN_SZWDSZ06       0.5203361  0.0040318   129.058  < 2e-16 ***
DESTIN_SZWDSZ07       0.6006472  0.0061745    97.279  < 2e-16 ***
DESTIN_SZWDSZ08       0.6650867  0.0060867   109.268  < 2e-16 ***
DESTIN_SZWDSZ09       0.6237312  0.0044830   139.132  < 2e-16 ***
DESTIN_SZYSSZ01       1.0471638  0.0038255   273.732  < 2e-16 ***
DESTIN_SZYSSZ02       0.2341114  0.0048213    48.558  < 2e-16 ***
DESTIN_SZYSSZ03      -0.0916446  0.0051335   -17.852  < 2e-16 ***
DESTIN_SZYSSZ04      -0.0085536  0.0048684    -1.757  0.07892 .  
DESTIN_SZYSSZ05      -1.5775071  0.0100297  -157.283  < 2e-16 ***
DESTIN_SZYSSZ06      -1.8130307  0.0098617  -183.846  < 2e-16 ***
DESTIN_SZYSSZ07      -1.1703963  0.0111525  -104.945  < 2e-16 ***
DESTIN_SZYSSZ08       0.5253514  0.0039556   132.813  < 2e-16 ***
DESTIN_SZYSSZ09       0.4353435  0.0038890   111.943  < 2e-16 ***
log(ORIGIN_AGE25_64)  0.2249135  0.0001404  1602.353  < 2e-16 ***
log(dist)            -0.6989356  0.0001287 -5431.279  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 60796037  on 14733  degrees of freedom
Residual deviance: 26208384  on 14452  degrees of freedom
AIC: 26300575

Number of Fisher Scoring iterations: 7

We can compute for the R-squared with the following

CalcRSquared(decSIM$data$TRIPS, decSIM$fitted.values)
[1] 0.4972985

Doubly constrained SIM

The code chunk below calibrates a doubly constrained SIM

dbcSIM <- glm(formula = TRIPS ~ 
                ORIGIN_SZ + 
                DESTIN_SZ + 
                log(dist),
              family = poisson(link = "log"),
              data = SIM_data,
              na.action = na.exclude)
summary(dbcSIM)

Call:
glm(formula = TRIPS ~ ORIGIN_SZ + DESTIN_SZ + log(dist), family = poisson(link = "log"), 
    data = SIM_data, na.action = na.exclude)

Coefficients:
                  Estimate Std. Error   z value Pr(>|z|)    
(Intercept)     12.4165310  0.0043949  2825.242  < 2e-16 ***
ORIGIN_SZAMSZ02  0.9496891  0.0045740   207.630  < 2e-16 ***
ORIGIN_SZAMSZ03  0.5519174  0.0046672   118.253  < 2e-16 ***
ORIGIN_SZAMSZ04  0.1028140  0.0052468    19.596  < 2e-16 ***
ORIGIN_SZAMSZ05  0.0822549  0.0058663    14.022  < 2e-16 ***
ORIGIN_SZAMSZ06  0.6617809  0.0052580   125.861  < 2e-16 ***
ORIGIN_SZAMSZ07 -0.9508298  0.0097681   -97.340  < 2e-16 ***
ORIGIN_SZAMSZ08 -0.7271779  0.0090946   -79.958  < 2e-16 ***
ORIGIN_SZAMSZ09  0.4896781  0.0055203    88.704  < 2e-16 ***
ORIGIN_SZAMSZ10  0.4819428  0.0048175   100.040  < 2e-16 ***
ORIGIN_SZAMSZ11 -1.7719841  0.0130695  -135.582  < 2e-16 ***
ORIGIN_SZAMSZ12 -1.7679107  0.0108777  -162.526  < 2e-16 ***
ORIGIN_SZBDSZ01  0.8314812  0.0045187   184.010  < 2e-16 ***
ORIGIN_SZBDSZ02  0.4305836  0.0052535    81.961  < 2e-16 ***
ORIGIN_SZBDSZ03  0.8009370  0.0046384   172.676  < 2e-16 ***
ORIGIN_SZBDSZ04  1.4562985  0.0040456   359.971  < 2e-16 ***
ORIGIN_SZBDSZ05  0.4501939  0.0046960    95.867  < 2e-16 ***
ORIGIN_SZBDSZ06  0.7745026  0.0047424   163.314  < 2e-16 ***
ORIGIN_SZBDSZ07 -1.1784123  0.0098105  -120.117  < 2e-16 ***
ORIGIN_SZBDSZ08 -0.9830996  0.0091135  -107.873  < 2e-16 ***
ORIGIN_SZBKSZ01 -0.3042966  0.0067086   -45.359  < 2e-16 ***
ORIGIN_SZBKSZ02  0.4801541  0.0054160    88.655  < 2e-16 ***
ORIGIN_SZBKSZ03  0.7823931  0.0052007   150.440  < 2e-16 ***
ORIGIN_SZBKSZ04 -0.1292545  0.0061735   -20.937  < 2e-16 ***
ORIGIN_SZBKSZ05 -0.0258584  0.0060192    -4.296 1.74e-05 ***
ORIGIN_SZBKSZ06  0.1994719  0.0061206    32.590  < 2e-16 ***
ORIGIN_SZBKSZ07  0.7434860  0.0046598   159.553  < 2e-16 ***
ORIGIN_SZBKSZ08  0.1625007  0.0055219    29.428  < 2e-16 ***
ORIGIN_SZBKSZ09 -0.0864293  0.0059533   -14.518  < 2e-16 ***
ORIGIN_SZBLSZ01 -2.1022485  0.0150316  -139.855  < 2e-16 ***
ORIGIN_SZBLSZ02 -2.9460181  0.0195760  -150.491  < 2e-16 ***
ORIGIN_SZBLSZ03 -4.9412872  0.0398540  -123.985  < 2e-16 ***
ORIGIN_SZBLSZ04 -2.8143593  0.0239209  -117.653  < 2e-16 ***
ORIGIN_SZBMSZ01 -0.0264561  0.0053639    -4.932 8.13e-07 ***
ORIGIN_SZBMSZ02 -0.8656513  0.0068511  -126.353  < 2e-16 ***
ORIGIN_SZBMSZ03 -0.1723467  0.0059613   -28.911  < 2e-16 ***
ORIGIN_SZBMSZ04  0.2169844  0.0053578    40.499  < 2e-16 ***
ORIGIN_SZBMSZ05 -2.0252956  0.0126107  -160.602  < 2e-16 ***
ORIGIN_SZBMSZ06 -1.7642018  0.0163931  -107.619  < 2e-16 ***
ORIGIN_SZBMSZ07 -0.3271629  0.0058137   -56.274  < 2e-16 ***
ORIGIN_SZBMSZ08 -0.2533255  0.0059335   -42.694  < 2e-16 ***
ORIGIN_SZBMSZ09 -0.7712635  0.0087939   -87.704  < 2e-16 ***
ORIGIN_SZBMSZ10 -1.0098048  0.0092519  -109.145  < 2e-16 ***
ORIGIN_SZBMSZ11 -0.3816187  0.0067302   -56.702  < 2e-16 ***
ORIGIN_SZBMSZ12 -0.6666616  0.0095680   -69.676  < 2e-16 ***
ORIGIN_SZBMSZ13 -0.0076108  0.0059040    -1.289  0.19737    
ORIGIN_SZBMSZ14 -0.1682476  0.0069391   -24.246  < 2e-16 ***
ORIGIN_SZBMSZ15  0.0904585  0.0062822    14.399  < 2e-16 ***
ORIGIN_SZBMSZ16 -1.1808741  0.0092258  -127.997  < 2e-16 ***
ORIGIN_SZBMSZ17 -1.7189127  0.0158408  -108.512  < 2e-16 ***
ORIGIN_SZBPSZ01  0.4294645  0.0058051    73.980  < 2e-16 ***
ORIGIN_SZBPSZ02  0.5028906  0.0068169    73.771  < 2e-16 ***
ORIGIN_SZBPSZ03  0.6656178  0.0066126   100.658  < 2e-16 ***
ORIGIN_SZBPSZ04  0.5203612  0.0053224    97.769  < 2e-16 ***
ORIGIN_SZBPSZ05  0.5377769  0.0047907   112.256  < 2e-16 ***
ORIGIN_SZBPSZ06 -1.2327809  0.0094950  -129.835  < 2e-16 ***
ORIGIN_SZBPSZ07 -0.9035255  0.0088739  -101.818  < 2e-16 ***
ORIGIN_SZBSSZ01  0.1210027  0.0053990    22.412  < 2e-16 ***
ORIGIN_SZBSSZ02  0.4618449  0.0048641    94.951  < 2e-16 ***
ORIGIN_SZBSSZ03  0.2160739  0.0047835    45.170  < 2e-16 ***
ORIGIN_SZBTSZ01 -0.1108042  0.0055599   -19.929  < 2e-16 ***
ORIGIN_SZBTSZ02 -0.8911221  0.0079213  -112.498  < 2e-16 ***
ORIGIN_SZBTSZ03 -0.2203980  0.0059325   -37.151  < 2e-16 ***
ORIGIN_SZBTSZ04 -0.6427946  0.0105438   -60.964  < 2e-16 ***
ORIGIN_SZBTSZ05 -1.4662312  0.0111784  -131.166  < 2e-16 ***
ORIGIN_SZBTSZ06 -0.6105884  0.0073456   -83.123  < 2e-16 ***
ORIGIN_SZBTSZ07 -1.9041317  0.0132781  -143.404  < 2e-16 ***
ORIGIN_SZBTSZ08 -1.0627939  0.0095982  -110.728  < 2e-16 ***
ORIGIN_SZCBSZ01 -2.9365941  0.0548632   -53.526  < 2e-16 ***
ORIGIN_SZCCSZ01 -1.5313555  0.0134599  -113.772  < 2e-16 ***
ORIGIN_SZCHSZ01 -1.2034494  0.0119468  -100.734  < 2e-16 ***
ORIGIN_SZCHSZ02 -0.8299415  0.0081984  -101.232  < 2e-16 ***
ORIGIN_SZCHSZ03 -0.5143946  0.0061944   -83.042  < 2e-16 ***
ORIGIN_SZCKSZ01  0.2372583  0.0053612    44.255  < 2e-16 ***
ORIGIN_SZCKSZ02  0.9124836  0.0054472   167.515  < 2e-16 ***
ORIGIN_SZCKSZ03  0.7237808  0.0048401   149.539  < 2e-16 ***
ORIGIN_SZCKSZ04  1.6884022  0.0050169   336.540  < 2e-16 ***
ORIGIN_SZCKSZ05  1.3932005  0.0062346   223.464  < 2e-16 ***
ORIGIN_SZCKSZ06  1.0670053  0.0066112   161.394  < 2e-16 ***
ORIGIN_SZCLSZ01 -0.8602837  0.0079240  -108.567  < 2e-16 ***
ORIGIN_SZCLSZ02 -1.3853421  0.0137444  -100.793  < 2e-16 ***
ORIGIN_SZCLSZ03 -0.8582608  0.0081177  -105.727  < 2e-16 ***
ORIGIN_SZCLSZ04  0.7836027  0.0046427   168.782  < 2e-16 ***
ORIGIN_SZCLSZ05 -1.8121756  0.0148960  -121.655  < 2e-16 ***
ORIGIN_SZCLSZ06  0.8296870  0.0043909   188.955  < 2e-16 ***
ORIGIN_SZCLSZ07 -0.2325219  0.0057432   -40.487  < 2e-16 ***
ORIGIN_SZCLSZ08  0.2714336  0.0062625    43.342  < 2e-16 ***
ORIGIN_SZCLSZ09 -2.2223744  0.0160946  -138.082  < 2e-16 ***
ORIGIN_SZDTSZ02 -4.0704970  0.0834192   -48.796  < 2e-16 ***
ORIGIN_SZDTSZ03 -3.4529031  0.0738295   -46.769  < 2e-16 ***
ORIGIN_SZDTSZ13 -2.8301983  0.0313085   -90.397  < 2e-16 ***
ORIGIN_SZGLSZ01 -1.4674986  0.0093137  -157.563  < 2e-16 ***
ORIGIN_SZGLSZ02  0.2749369  0.0050051    54.931  < 2e-16 ***
ORIGIN_SZGLSZ03  0.0781954  0.0049748    15.718  < 2e-16 ***
ORIGIN_SZGLSZ04  0.8167797  0.0043260   188.808  < 2e-16 ***
ORIGIN_SZGLSZ05  0.5277509  0.0044879   117.595  < 2e-16 ***
ORIGIN_SZHGSZ01  0.2323885  0.0048555    47.861  < 2e-16 ***
ORIGIN_SZHGSZ02  0.5707182  0.0048256   118.268  < 2e-16 ***
ORIGIN_SZHGSZ03  0.4231170  0.0052149    81.136  < 2e-16 ***
ORIGIN_SZHGSZ04  0.9341168  0.0044128   211.681  < 2e-16 ***
ORIGIN_SZHGSZ05  1.2192790  0.0043790   278.437  < 2e-16 ***
ORIGIN_SZHGSZ06  0.0490041  0.0054961     8.916  < 2e-16 ***
ORIGIN_SZHGSZ07  0.6337041  0.0045735   138.559  < 2e-16 ***
ORIGIN_SZHGSZ08  0.0312612  0.0054684     5.717 1.09e-08 ***
ORIGIN_SZHGSZ09 -0.6985397  0.0071800   -97.289  < 2e-16 ***
ORIGIN_SZHGSZ10 -2.9958967  0.0422303   -70.942  < 2e-16 ***
ORIGIN_SZJESZ01  0.4363431  0.0051329    85.010  < 2e-16 ***
ORIGIN_SZJESZ02  0.3460900  0.0051372    67.370  < 2e-16 ***
ORIGIN_SZJESZ03  0.2928005  0.0055108    53.132  < 2e-16 ***
ORIGIN_SZJESZ04 -1.1924298  0.0093540  -127.478  < 2e-16 ***
ORIGIN_SZJESZ05 -2.0178136  0.0139479  -144.668  < 2e-16 ***
ORIGIN_SZJESZ06  0.1637633  0.0050685    32.310  < 2e-16 ***
ORIGIN_SZJESZ07 -1.8227460  0.0119383  -152.680  < 2e-16 ***
ORIGIN_SZJESZ08 -1.1556281  0.0117870   -98.043  < 2e-16 ***
ORIGIN_SZJESZ09  0.4766229  0.0052813    90.248  < 2e-16 ***
ORIGIN_SZJESZ10 -2.6868992  0.0186864  -143.789  < 2e-16 ***
ORIGIN_SZJESZ11 -3.0618150  0.0199755  -153.278  < 2e-16 ***
ORIGIN_SZJWSZ01  0.4417418  0.0068611    64.383  < 2e-16 ***
ORIGIN_SZJWSZ02  0.9738087  0.0047905   203.281  < 2e-16 ***
ORIGIN_SZJWSZ03  1.1548028  0.0045180   255.599  < 2e-16 ***
ORIGIN_SZJWSZ04  0.9078417  0.0046668   194.532  < 2e-16 ***
ORIGIN_SZJWSZ05 -1.7092500  0.0127422  -134.141  < 2e-16 ***
ORIGIN_SZJWSZ06 -1.3284287  0.0109785  -121.002  < 2e-16 ***
ORIGIN_SZJWSZ07 -2.3231549  0.0281427   -82.549  < 2e-16 ***
ORIGIN_SZJWSZ08  1.9386127  0.0046041   421.059  < 2e-16 ***
ORIGIN_SZJWSZ09  1.3987549  0.0042610   328.266  < 2e-16 ***
ORIGIN_SZKLSZ01  0.2617735  0.0050089    52.261  < 2e-16 ***
ORIGIN_SZKLSZ02 -0.4325093  0.0064279   -67.286  < 2e-16 ***
ORIGIN_SZKLSZ03 -0.2787173  0.0060380   -46.161  < 2e-16 ***
ORIGIN_SZKLSZ04 -1.9432693  0.0119163  -163.076  < 2e-16 ***
ORIGIN_SZKLSZ05 -0.5420067  0.0085529   -63.371  < 2e-16 ***
ORIGIN_SZKLSZ06 -4.2949009  0.1857686   -23.120  < 2e-16 ***
ORIGIN_SZKLSZ07 -0.8576946  0.0085178  -100.694  < 2e-16 ***
ORIGIN_SZKLSZ08 -1.3840925  0.0092323  -149.918  < 2e-16 ***
ORIGIN_SZLKSZ01 -2.8108510  0.0392356   -71.640  < 2e-16 ***
ORIGIN_SZMDSZ01 -1.6745388  0.0296543   -56.469  < 2e-16 ***
ORIGIN_SZMDSZ02 -0.8193738  0.0106631   -76.842  < 2e-16 ***
ORIGIN_SZMDSZ03 -1.5088267  0.0172032   -87.706  < 2e-16 ***
ORIGIN_SZMPSZ01 -0.9860154  0.0085053  -115.929  < 2e-16 ***
ORIGIN_SZMPSZ02 -0.5958875  0.0070097   -85.008  < 2e-16 ***
ORIGIN_SZMPSZ03 -0.0490122  0.0054582    -8.980  < 2e-16 ***
ORIGIN_SZMUSZ02 -3.5233367  0.1037749   -33.952  < 2e-16 ***
ORIGIN_SZNTSZ01 -2.6451541  0.0353125   -74.907  < 2e-16 ***
ORIGIN_SZNTSZ02 -2.7710546  0.0232841  -119.011  < 2e-16 ***
ORIGIN_SZNTSZ03 -0.6123404  0.0079083   -77.430  < 2e-16 ***
ORIGIN_SZNTSZ05 -2.9257445  0.0496704   -58.903  < 2e-16 ***
ORIGIN_SZNTSZ06 -3.3260031  0.0557966   -59.609  < 2e-16 ***
ORIGIN_SZNVSZ01  0.6421306  0.0046037   139.482  < 2e-16 ***
ORIGIN_SZNVSZ02 -0.4251550  0.0065890   -64.525  < 2e-16 ***
ORIGIN_SZNVSZ03 -1.0765622  0.0078766  -136.679  < 2e-16 ***
ORIGIN_SZNVSZ04 -1.2289504  0.0091468  -134.358  < 2e-16 ***
ORIGIN_SZNVSZ05 -2.3551389  0.0158219  -148.853  < 2e-16 ***
ORIGIN_SZPGSZ01  0.1518212  0.0154825     9.806  < 2e-16 ***
ORIGIN_SZPGSZ02 -0.4062609  0.0073780   -55.064  < 2e-16 ***
ORIGIN_SZPGSZ03  0.8976913  0.0046122   194.636  < 2e-16 ***
ORIGIN_SZPGSZ04  1.1161685  0.0045850   243.437  < 2e-16 ***
ORIGIN_SZPGSZ05  0.4794249  0.0060213    79.621  < 2e-16 ***
ORIGIN_SZPLSZ01 -0.8322377  0.0107898   -77.132  < 2e-16 ***
ORIGIN_SZPLSZ02 -1.2968937  0.0149841   -86.551  < 2e-16 ***
ORIGIN_SZPLSZ03 -3.2744991  0.0374541   -87.427  < 2e-16 ***
ORIGIN_SZPLSZ04 -3.5423615  0.0372570   -95.079  < 2e-16 ***
ORIGIN_SZPLSZ05 -2.4343705  0.0227807  -106.861  < 2e-16 ***
ORIGIN_SZPNSZ01  0.8052461  0.0056124   143.476  < 2e-16 ***
ORIGIN_SZPNSZ02 -1.8042362  0.0128222  -140.712  < 2e-16 ***
ORIGIN_SZPNSZ03 -2.6363996  0.0200058  -131.782  < 2e-16 ***
ORIGIN_SZPNSZ04 -4.8427070  0.0320126  -151.275  < 2e-16 ***
ORIGIN_SZPNSZ05 -3.6613775  0.0285686  -128.161  < 2e-16 ***
ORIGIN_SZPRSZ01 -0.5645384  0.0117126   -48.199  < 2e-16 ***
ORIGIN_SZPRSZ02  0.9145886  0.0048137   189.998  < 2e-16 ***
ORIGIN_SZPRSZ03  0.4478971  0.0048102    93.113  < 2e-16 ***
ORIGIN_SZPRSZ04 -0.5312444  0.0079019   -67.230  < 2e-16 ***
ORIGIN_SZPRSZ05  1.1462662  0.0045250   253.318  < 2e-16 ***
ORIGIN_SZPRSZ06 -0.7392744  0.0090347   -81.826  < 2e-16 ***
ORIGIN_SZPRSZ07 -2.1667862  0.0162528  -133.318  < 2e-16 ***
ORIGIN_SZPRSZ08 -0.1327079  0.0065712   -20.195  < 2e-16 ***
ORIGIN_SZQTSZ01  0.1062151  0.0071538    14.847  < 2e-16 ***
ORIGIN_SZQTSZ02 -0.4993990  0.0064382   -77.568  < 2e-16 ***
ORIGIN_SZQTSZ03  0.1161844  0.0058822    19.752  < 2e-16 ***
ORIGIN_SZQTSZ04 -0.8102612  0.0072742  -111.389  < 2e-16 ***
ORIGIN_SZQTSZ05 -0.0417272  0.0061917    -6.739 1.59e-11 ***
ORIGIN_SZQTSZ06 -0.2521417  0.0066449   -37.945  < 2e-16 ***
ORIGIN_SZQTSZ07 -1.2395975  0.0097496  -127.143  < 2e-16 ***
ORIGIN_SZQTSZ08 -0.1105467  0.0059364   -18.622  < 2e-16 ***
ORIGIN_SZQTSZ09 -0.5078461  0.0067895   -74.798  < 2e-16 ***
ORIGIN_SZQTSZ10 -0.3866593  0.0066995   -57.714  < 2e-16 ***
ORIGIN_SZQTSZ11 -1.5264609  0.0099770  -152.998  < 2e-16 ***
ORIGIN_SZQTSZ12 -1.3866518  0.0106887  -129.730  < 2e-16 ***
ORIGIN_SZQTSZ13 -0.3764286  0.0066707   -56.430  < 2e-16 ***
ORIGIN_SZQTSZ14 -1.4907399  0.0100120  -148.896  < 2e-16 ***
ORIGIN_SZQTSZ15 -1.0552239  0.0108792   -96.994  < 2e-16 ***
ORIGIN_SZRCSZ01 -1.3136074  0.0126986  -103.445  < 2e-16 ***
ORIGIN_SZRCSZ06 -0.2418276  0.0085509   -28.281  < 2e-16 ***
ORIGIN_SZRVSZ01 -2.9263747  0.0324968   -90.051  < 2e-16 ***
ORIGIN_SZRVSZ02 -2.2980940  0.0278202   -82.605  < 2e-16 ***
ORIGIN_SZRVSZ03 -2.4663765  0.0238674  -103.336  < 2e-16 ***
ORIGIN_SZRVSZ04 -3.1853677  0.0556939   -57.194  < 2e-16 ***
ORIGIN_SZRVSZ05 -1.5695490  0.0166684   -94.163  < 2e-16 ***
ORIGIN_SZSBSZ01  0.7674590  0.0061811   124.163  < 2e-16 ***
ORIGIN_SZSBSZ02 -0.7307279  0.0084105   -86.883  < 2e-16 ***
ORIGIN_SZSBSZ03  0.5920074  0.0050167   118.008  < 2e-16 ***
ORIGIN_SZSBSZ04  0.3684857  0.0058575    62.908  < 2e-16 ***
ORIGIN_SZSBSZ05 -0.0036863  0.0068459    -0.538  0.59026    
ORIGIN_SZSBSZ06 -1.1939284  0.0181541   -65.766  < 2e-16 ***
ORIGIN_SZSBSZ07 -0.4896579  0.0135618   -36.106  < 2e-16 ***
ORIGIN_SZSBSZ08 -2.1221691  0.0127258  -166.762  < 2e-16 ***
ORIGIN_SZSBSZ09 -1.2032410  0.0089611  -134.273  < 2e-16 ***
ORIGIN_SZSESZ02  1.0721820  0.0045336   236.498  < 2e-16 ***
ORIGIN_SZSESZ03  1.0808012  0.0042923   251.801  < 2e-16 ***
ORIGIN_SZSESZ04  1.0137448  0.0050668   200.076  < 2e-16 ***
ORIGIN_SZSESZ05 -0.1678679  0.0060206   -27.882  < 2e-16 ***
ORIGIN_SZSESZ06  0.9165834  0.0048323   189.677  < 2e-16 ***
ORIGIN_SZSESZ07 -2.2499789  0.0196327  -114.603  < 2e-16 ***
ORIGIN_SZSGSZ01 -0.9369800  0.0087282  -107.351  < 2e-16 ***
ORIGIN_SZSGSZ02 -1.1690716  0.0097131  -120.360  < 2e-16 ***
ORIGIN_SZSGSZ03  0.2604352  0.0052709    49.410  < 2e-16 ***
ORIGIN_SZSGSZ04  0.3468823  0.0048897    70.942  < 2e-16 ***
ORIGIN_SZSGSZ05 -1.5927797  0.0106308  -149.827  < 2e-16 ***
ORIGIN_SZSGSZ06  0.3605651  0.0046361    77.774  < 2e-16 ***
ORIGIN_SZSGSZ07 -0.5333873  0.0063119   -84.504  < 2e-16 ***
ORIGIN_SZSKSZ01 -0.2706750  0.0082836   -32.676  < 2e-16 ***
ORIGIN_SZSKSZ02  0.0970953  0.0063378    15.320  < 2e-16 ***
ORIGIN_SZSKSZ03 -0.6954342  0.0082538   -84.256  < 2e-16 ***
ORIGIN_SZSKSZ04 -2.3863580  0.0284607   -83.847  < 2e-16 ***
ORIGIN_SZSKSZ05 -1.5443140  0.0179059   -86.246  < 2e-16 ***
ORIGIN_SZSLSZ01 -2.9450656  0.0307283   -95.842  < 2e-16 ***
ORIGIN_SZSLSZ04 -0.5739349  0.0077851   -73.722  < 2e-16 ***
ORIGIN_SZSRSZ01 -1.6136735  0.0160199  -100.729  < 2e-16 ***
ORIGIN_SZTHSZ01 -2.6034976  0.0489378   -53.200  < 2e-16 ***
ORIGIN_SZTHSZ03 -1.2770601  0.0229815   -55.569  < 2e-16 ***
ORIGIN_SZTHSZ04 -2.0110399  0.0287527   -69.943  < 2e-16 ***
ORIGIN_SZTHSZ06 -1.7720116  0.0180394   -98.230  < 2e-16 ***
ORIGIN_SZTMSZ01  0.1254729  0.0060924    20.595  < 2e-16 ***
ORIGIN_SZTMSZ02  1.6667504  0.0039836   418.403  < 2e-16 ***
ORIGIN_SZTMSZ03  1.0941176  0.0042911   254.976  < 2e-16 ***
ORIGIN_SZTMSZ04  0.3209520  0.0050349    63.746  < 2e-16 ***
ORIGIN_SZTMSZ05 -0.8155124  0.0079342  -102.785  < 2e-16 ***
ORIGIN_SZTNSZ01 -1.4237298  0.0104636  -136.064  < 2e-16 ***
ORIGIN_SZTNSZ02 -1.2718890  0.0098660  -128.916  < 2e-16 ***
ORIGIN_SZTNSZ03 -1.7960517  0.0134675  -133.362  < 2e-16 ***
ORIGIN_SZTNSZ04 -0.3508142  0.0073556   -47.694  < 2e-16 ***
ORIGIN_SZTPSZ01 -0.3841699  0.0064137   -59.898  < 2e-16 ***
ORIGIN_SZTPSZ02  0.5315265  0.0044497   119.451  < 2e-16 ***
ORIGIN_SZTPSZ03 -0.4669723  0.0062160   -75.124  < 2e-16 ***
ORIGIN_SZTPSZ04 -0.0617169  0.0058830   -10.491  < 2e-16 ***
ORIGIN_SZTPSZ05  0.0713309  0.0062133    11.480  < 2e-16 ***
ORIGIN_SZTPSZ06  0.6800356  0.0069456    97.909  < 2e-16 ***
ORIGIN_SZTPSZ07 -0.0432782  0.0064382    -6.722 1.79e-11 ***
ORIGIN_SZTPSZ08 -0.6976429  0.0092416   -75.490  < 2e-16 ***
ORIGIN_SZTPSZ09 -0.3708833  0.0063548   -58.363  < 2e-16 ***
ORIGIN_SZTPSZ10 -0.4063575  0.0077803   -52.229  < 2e-16 ***
ORIGIN_SZTPSZ11  0.1040282  0.0056115    18.538  < 2e-16 ***
ORIGIN_SZTPSZ12 -0.5104672  0.0066261   -77.039  < 2e-16 ***
ORIGIN_SZTSSZ01 -3.5036830  0.0487290   -71.901  < 2e-16 ***
ORIGIN_SZTSSZ02 -0.0386819  0.0094886    -4.077 4.57e-05 ***
ORIGIN_SZTSSZ03 -0.3862387  0.0095139   -40.597  < 2e-16 ***
ORIGIN_SZTSSZ04 -0.6380676  0.0099905   -63.867  < 2e-16 ***
ORIGIN_SZTSSZ05 -2.7354613  0.0162414  -168.425  < 2e-16 ***
ORIGIN_SZTSSZ06 -2.6310865  0.0255772  -102.868  < 2e-16 ***
ORIGIN_SZWCSZ01 -1.1561047  0.0087394  -132.286  < 2e-16 ***
ORIGIN_SZWCSZ02 -2.6956217  0.0319117   -84.471  < 2e-16 ***
ORIGIN_SZWCSZ03 -4.3526889  0.1241082   -35.072  < 2e-16 ***
ORIGIN_SZWDSZ01  0.8712417  0.0043720   199.277  < 2e-16 ***
ORIGIN_SZWDSZ02  0.9119539  0.0050326   181.210  < 2e-16 ***
ORIGIN_SZWDSZ03  1.6205678  0.0045250   358.136  < 2e-16 ***
ORIGIN_SZWDSZ04  1.2081941  0.0054272   222.618  < 2e-16 ***
ORIGIN_SZWDSZ05  0.4284783  0.0052752    81.224  < 2e-16 ***
ORIGIN_SZWDSZ06  0.9018716  0.0049820   181.028  < 2e-16 ***
ORIGIN_SZWDSZ07 -0.6444820  0.0084731   -76.062  < 2e-16 ***
ORIGIN_SZWDSZ08 -0.8764983  0.0082622  -106.085  < 2e-16 ***
ORIGIN_SZWDSZ09  1.3292589  0.0048663   273.158  < 2e-16 ***
ORIGIN_SZYSSZ01 -0.4780462  0.0058489   -81.733  < 2e-16 ***
ORIGIN_SZYSSZ02  0.9323419  0.0054402   171.380  < 2e-16 ***
ORIGIN_SZYSSZ03  2.0577240  0.0046737   440.274  < 2e-16 ***
ORIGIN_SZYSSZ04  0.8697472  0.0047269   184.000  < 2e-16 ***
ORIGIN_SZYSSZ05  0.1662764  0.0060376    27.540  < 2e-16 ***
ORIGIN_SZYSSZ06 -0.8115617  0.0109084   -74.398  < 2e-16 ***
ORIGIN_SZYSSZ07 -0.8971248  0.0119220   -75.250  < 2e-16 ***
ORIGIN_SZYSSZ08 -0.2738680  0.0063553   -43.093  < 2e-16 ***
ORIGIN_SZYSSZ09  1.2274518  0.0044951   273.066  < 2e-16 ***
DESTIN_SZAMSZ02 -0.0516322  0.0042829   -12.055  < 2e-16 ***
DESTIN_SZAMSZ03  0.0801823  0.0041904    19.135  < 2e-16 ***
DESTIN_SZAMSZ04 -0.9282211  0.0061322  -151.368  < 2e-16 ***
DESTIN_SZAMSZ05 -1.0794168  0.0062543  -172.588  < 2e-16 ***
DESTIN_SZAMSZ06 -0.8839603  0.0060851  -145.267  < 2e-16 ***
DESTIN_SZAMSZ07 -1.5835093  0.0096846  -163.508  < 2e-16 ***
DESTIN_SZAMSZ08 -0.9756903  0.0068829  -141.756  < 2e-16 ***
DESTIN_SZAMSZ09 -1.0362692  0.0061651  -168.087  < 2e-16 ***
DESTIN_SZAMSZ10 -0.1227646  0.0044788   -27.410  < 2e-16 ***
DESTIN_SZAMSZ11 -0.4802374  0.0088108   -54.506  < 2e-16 ***
DESTIN_SZAMSZ12  0.2142621  0.0050653    42.300  < 2e-16 ***
DESTIN_SZBDSZ01  0.3582789  0.0039578    90.524  < 2e-16 ***
DESTIN_SZBDSZ02 -0.4368229  0.0051384   -85.012  < 2e-16 ***
DESTIN_SZBDSZ03 -0.1568727  0.0044329   -35.388  < 2e-16 ***
DESTIN_SZBDSZ04  0.6731669  0.0036215   185.882  < 2e-16 ***
DESTIN_SZBDSZ05  0.3647198  0.0040496    90.062  < 2e-16 ***
DESTIN_SZBDSZ06  0.0589240  0.0044352    13.286  < 2e-16 ***
DESTIN_SZBDSZ07 -0.6648168  0.0095742   -69.438  < 2e-16 ***
DESTIN_SZBDSZ08 -1.7214136  0.0106600  -161.483  < 2e-16 ***
DESTIN_SZBKSZ01 -1.2688264  0.0067263  -188.637  < 2e-16 ***
DESTIN_SZBKSZ02 -0.3912129  0.0055446   -70.558  < 2e-16 ***
DESTIN_SZBKSZ03 -0.8663392  0.0058693  -147.605  < 2e-16 ***
DESTIN_SZBKSZ04 -0.1247273  0.0051254   -24.335  < 2e-16 ***
DESTIN_SZBKSZ05 -0.7407774  0.0059120  -125.300  < 2e-16 ***
DESTIN_SZBKSZ06 -0.9934643  0.0063345  -156.834  < 2e-16 ***
DESTIN_SZBKSZ07  0.0882230  0.0042928    20.551  < 2e-16 ***
DESTIN_SZBKSZ08 -1.1134447  0.0070752  -157.372  < 2e-16 ***
DESTIN_SZBKSZ09 -0.1788171  0.0051327   -34.839  < 2e-16 ***
DESTIN_SZBLSZ01 -0.7696433  0.0071898  -107.047  < 2e-16 ***
DESTIN_SZBLSZ02  0.4076650  0.0068001    59.950  < 2e-16 ***
DESTIN_SZBLSZ03  1.5398488  0.0078230   196.836  < 2e-16 ***
DESTIN_SZBLSZ04 -0.3499486  0.0136985   -25.546  < 2e-16 ***
DESTIN_SZBMSZ01 -0.2114705  0.0048311   -43.773  < 2e-16 ***
DESTIN_SZBMSZ02 -0.3316806  0.0049958   -66.391  < 2e-16 ***
DESTIN_SZBMSZ03 -0.5134774  0.0058534   -87.723  < 2e-16 ***
DESTIN_SZBMSZ04 -0.2205274  0.0051028   -43.217  < 2e-16 ***
DESTIN_SZBMSZ05 -0.2101165  0.0067710   -31.032  < 2e-16 ***
DESTIN_SZBMSZ06 -1.3832385  0.0124821  -110.818  < 2e-16 ***
DESTIN_SZBMSZ07 -0.0133462  0.0046787    -2.853  0.00434 ** 
DESTIN_SZBMSZ08 -0.9056756  0.0063868  -141.805  < 2e-16 ***
DESTIN_SZBMSZ09 -2.3175407  0.0144523  -160.358  < 2e-16 ***
DESTIN_SZBMSZ10 -1.3973725  0.0090463  -154.470  < 2e-16 ***
DESTIN_SZBMSZ11 -1.3950206  0.0080459  -173.383  < 2e-16 ***
DESTIN_SZBMSZ12 -0.6882789  0.0081539   -84.411  < 2e-16 ***
DESTIN_SZBMSZ13 -0.2729120  0.0052969   -51.523  < 2e-16 ***
DESTIN_SZBMSZ14 -0.7581980  0.0080215   -94.521  < 2e-16 ***
DESTIN_SZBMSZ15 -0.9323237  0.0071093  -131.142  < 2e-16 ***
DESTIN_SZBMSZ16 -2.0655530  0.0108490  -190.391  < 2e-16 ***
DESTIN_SZBMSZ17 -2.5124893  0.0165366  -151.935  < 2e-16 ***
DESTIN_SZBPSZ01 -0.8203274  0.0057682  -142.216  < 2e-16 ***
DESTIN_SZBPSZ02 -1.5284265  0.0087447  -174.783  < 2e-16 ***
DESTIN_SZBPSZ03 -1.2434382  0.0080852  -153.792  < 2e-16 ***
DESTIN_SZBPSZ04 -0.7778558  0.0060900  -127.727  < 2e-16 ***
DESTIN_SZBPSZ05  0.1782204  0.0042331    42.101  < 2e-16 ***
DESTIN_SZBPSZ06 -0.6758807  0.0079728   -84.773  < 2e-16 ***
DESTIN_SZBPSZ07 -0.5029450  0.0081151   -61.976  < 2e-16 ***
DESTIN_SZBSSZ01 -0.1269916  0.0046949   -27.049  < 2e-16 ***
DESTIN_SZBSSZ02 -0.7536917  0.0051895  -145.233  < 2e-16 ***
DESTIN_SZBSSZ03  0.2747969  0.0039115    70.254  < 2e-16 ***
DESTIN_SZBTSZ01  0.1708577  0.0043381    39.385  < 2e-16 ***
DESTIN_SZBTSZ02 -0.6820190  0.0067243  -101.427  < 2e-16 ***
DESTIN_SZBTSZ03  0.0610599  0.0049825    12.255  < 2e-16 ***
DESTIN_SZBTSZ04 -1.3199639  0.0107063  -123.288  < 2e-16 ***
DESTIN_SZBTSZ05 -0.4174991  0.0069221   -60.314  < 2e-16 ***
DESTIN_SZBTSZ06 -0.5260242  0.0061145   -86.029  < 2e-16 ***
DESTIN_SZBTSZ07 -1.6678047  0.0106335  -156.844  < 2e-16 ***
DESTIN_SZBTSZ08 -0.7999935  0.0089175   -89.711  < 2e-16 ***
DESTIN_SZCBSZ01 -5.6321332  0.3162476   -17.809  < 2e-16 ***
DESTIN_SZCCSZ01 -0.9342781  0.0081409  -114.763  < 2e-16 ***
DESTIN_SZCHSZ01 -1.2808546  0.0096774  -132.355  < 2e-16 ***
DESTIN_SZCHSZ02  0.0067332  0.0054322     1.239  0.21516    
DESTIN_SZCHSZ03  1.0988838  0.0041378   265.570  < 2e-16 ***
DESTIN_SZCKSZ01 -0.3192235  0.0050632   -63.048  < 2e-16 ***
DESTIN_SZCKSZ02 -0.7776453  0.0055279  -140.676  < 2e-16 ***
DESTIN_SZCKSZ03  0.2772358  0.0042541    65.170  < 2e-16 ***
DESTIN_SZCKSZ04 -1.3842048  0.0065159  -212.436  < 2e-16 ***
DESTIN_SZCKSZ05 -1.2051808  0.0076814  -156.897  < 2e-16 ***
DESTIN_SZCKSZ06  0.1321955  0.0061568    21.472  < 2e-16 ***
DESTIN_SZCLSZ01  0.1942449  0.0049977    38.867  < 2e-16 ***
DESTIN_SZCLSZ02 -2.0828648  0.0134597  -154.749  < 2e-16 ***
DESTIN_SZCLSZ03 -0.8823728  0.0078307  -112.681  < 2e-16 ***
DESTIN_SZCLSZ04 -0.2311432  0.0047194   -48.977  < 2e-16 ***
DESTIN_SZCLSZ05 -1.0113430  0.0085536  -118.237  < 2e-16 ***
DESTIN_SZCLSZ06  0.0694682  0.0042166    16.475  < 2e-16 ***
DESTIN_SZCLSZ07 -0.4953961  0.0054184   -91.429  < 2e-16 ***
DESTIN_SZCLSZ08 -0.3849563  0.0061404   -62.693  < 2e-16 ***
DESTIN_SZCLSZ09  0.4201808  0.0067112    62.609  < 2e-16 ***
DESTIN_SZDTSZ02 -2.6513032  0.0348725   -76.029  < 2e-16 ***
DESTIN_SZDTSZ03 -1.5192228  0.0144477  -105.153  < 2e-16 ***
DESTIN_SZDTSZ13 -2.2041951  0.0161726  -136.292  < 2e-16 ***
DESTIN_SZGLSZ01 -0.0139744  0.0052464    -2.664  0.00773 ** 
DESTIN_SZGLSZ02 -0.2850816  0.0047467   -60.059  < 2e-16 ***
DESTIN_SZGLSZ03  0.3511872  0.0039473    88.969  < 2e-16 ***
DESTIN_SZGLSZ04  0.2909117  0.0039436    73.769  < 2e-16 ***
DESTIN_SZGLSZ05  0.1845361  0.0040011    46.121  < 2e-16 ***
DESTIN_SZHGSZ01  0.1418382  0.0039875    35.571  < 2e-16 ***
DESTIN_SZHGSZ02 -0.7233151  0.0052374  -138.105  < 2e-16 ***
DESTIN_SZHGSZ03 -1.1918463  0.0062129  -191.834  < 2e-16 ***
DESTIN_SZHGSZ04 -0.4380360  0.0044839   -97.691  < 2e-16 ***
DESTIN_SZHGSZ05 -0.5671024  0.0046427  -122.149  < 2e-16 ***
DESTIN_SZHGSZ06 -0.8271411  0.0054935  -150.566  < 2e-16 ***
DESTIN_SZHGSZ07  0.0721800  0.0041589    17.356  < 2e-16 ***
DESTIN_SZHGSZ08 -0.4297429  0.0050021   -85.913  < 2e-16 ***
DESTIN_SZHGSZ09 -0.2085461  0.0052544   -39.690  < 2e-16 ***
DESTIN_SZHGSZ10 -2.9169699  0.0262698  -111.039  < 2e-16 ***
DESTIN_SZJESZ01 -0.2822473  0.0051166   -55.163  < 2e-16 ***
DESTIN_SZJESZ02 -0.6761389  0.0053635  -126.063  < 2e-16 ***
DESTIN_SZJESZ03 -0.7371756  0.0058983  -124.980  < 2e-16 ***
DESTIN_SZJESZ04 -0.4593491  0.0067970   -67.581  < 2e-16 ***
DESTIN_SZJESZ05 -1.1418012  0.0099049  -115.277  < 2e-16 ***
DESTIN_SZJESZ06  0.1759680  0.0042791    41.123  < 2e-16 ***
DESTIN_SZJESZ07 -1.2260587  0.0082714  -148.229  < 2e-16 ***
DESTIN_SZJESZ08 -0.8547001  0.0080417  -106.283  < 2e-16 ***
DESTIN_SZJESZ09 -0.4306353  0.0057006   -75.542  < 2e-16 ***
DESTIN_SZJESZ10  0.6584971  0.0073664    89.392  < 2e-16 ***
DESTIN_SZJESZ11  0.9661208  0.0070491   137.056  < 2e-16 ***
DESTIN_SZJWSZ01 -0.9128436  0.0069529  -131.290  < 2e-16 ***
DESTIN_SZJWSZ02 -0.7285851  0.0054839  -132.859  < 2e-16 ***
DESTIN_SZJWSZ03  0.2601455  0.0043215    60.198  < 2e-16 ***
DESTIN_SZJWSZ04  0.6860274  0.0041135   166.775  < 2e-16 ***
DESTIN_SZJWSZ05 -0.4684576  0.0062875   -74.506  < 2e-16 ***
DESTIN_SZJWSZ06 -0.2459774  0.0057575   -42.723  < 2e-16 ***
DESTIN_SZJWSZ07 -1.8854234  0.0287721   -65.529  < 2e-16 ***
DESTIN_SZJWSZ08 -0.5523308  0.0051054  -108.186  < 2e-16 ***
DESTIN_SZJWSZ09  0.8818747  0.0037800   233.301  < 2e-16 ***
DESTIN_SZKLSZ01 -0.5814386  0.0052711  -110.308  < 2e-16 ***
DESTIN_SZKLSZ02 -0.7090577  0.0058161  -121.914  < 2e-16 ***
DESTIN_SZKLSZ03 -1.2191910  0.0065984  -184.772  < 2e-16 ***
DESTIN_SZKLSZ04 -1.6961428  0.0087866  -193.038  < 2e-16 ***
DESTIN_SZKLSZ05 -0.6927144  0.0073574   -94.153  < 2e-16 ***
DESTIN_SZKLSZ06 -2.2967464  0.0362605   -63.340  < 2e-16 ***
DESTIN_SZKLSZ07 -0.9536980  0.0066777  -142.819  < 2e-16 ***
DESTIN_SZKLSZ08 -0.4565596  0.0051736   -88.249  < 2e-16 ***
DESTIN_SZLKSZ01 -1.7277135  0.0207336   -83.329  < 2e-16 ***
DESTIN_SZMDSZ01 -1.7155417  0.0210080   -81.661  < 2e-16 ***
DESTIN_SZMDSZ02 -1.3694928  0.0114174  -119.948  < 2e-16 ***
DESTIN_SZMDSZ03 -2.7183729  0.0252678  -107.582  < 2e-16 ***
DESTIN_SZMPSZ01 -0.8051991  0.0078564  -102.490  < 2e-16 ***
DESTIN_SZMPSZ02 -0.7627000  0.0061386  -124.246  < 2e-16 ***
DESTIN_SZMPSZ03 -0.0649484  0.0047787   -13.591  < 2e-16 ***
DESTIN_SZMUSZ02 -1.9549128  0.0200160   -97.667  < 2e-16 ***
DESTIN_SZNTSZ01 -3.3048398  0.0448053   -73.760  < 2e-16 ***
DESTIN_SZNTSZ02 -1.6454847  0.0109337  -150.497  < 2e-16 ***
DESTIN_SZNTSZ03 -1.1389723  0.0077396  -147.161  < 2e-16 ***
DESTIN_SZNTSZ05 -2.0264109  0.0250226   -80.983  < 2e-16 ***
DESTIN_SZNTSZ06 -3.3496282  0.0428989   -78.082  < 2e-16 ***
DESTIN_SZNVSZ01 -0.3407614  0.0045493   -74.905  < 2e-16 ***
DESTIN_SZNVSZ02 -0.4987695  0.0053942   -92.465  < 2e-16 ***
DESTIN_SZNVSZ03 -0.4936107  0.0055158   -89.491  < 2e-16 ***
DESTIN_SZNVSZ04 -1.9141281  0.0107557  -177.964  < 2e-16 ***
DESTIN_SZNVSZ05 -1.5378263  0.0089577  -171.677  < 2e-16 ***
DESTIN_SZPGSZ01 -1.7744485  0.0194346   -91.304  < 2e-16 ***
DESTIN_SZPGSZ02 -0.9282918  0.0069006  -134.523  < 2e-16 ***
DESTIN_SZPGSZ03  0.0885025  0.0042145    21.000  < 2e-16 ***
DESTIN_SZPGSZ04 -0.3879375  0.0046862   -82.784  < 2e-16 ***
DESTIN_SZPGSZ05 -0.9649873  0.0074625  -129.311  < 2e-16 ***
DESTIN_SZPLSZ01 -0.6159175  0.0070845   -86.939  < 2e-16 ***
DESTIN_SZPLSZ02 -1.7551386  0.0133081  -131.885  < 2e-16 ***
DESTIN_SZPLSZ03 -0.1378379  0.0098704   -13.965  < 2e-16 ***
DESTIN_SZPLSZ04 -0.1411200  0.0096446   -14.632  < 2e-16 ***
DESTIN_SZPLSZ05 -0.8483196  0.0119048   -71.259  < 2e-16 ***
DESTIN_SZPNSZ01 -0.1579087  0.0057330   -27.544  < 2e-16 ***
DESTIN_SZPNSZ02  1.0243480  0.0076680   133.587  < 2e-16 ***
DESTIN_SZPNSZ03  0.0451598  0.0081444     5.545 2.94e-08 ***
DESTIN_SZPNSZ04  1.8941928  0.0087479   216.530  < 2e-16 ***
DESTIN_SZPNSZ05  1.0341581  0.0130830    79.046  < 2e-16 ***
DESTIN_SZPRSZ01 -1.4038513  0.0086911  -161.527  < 2e-16 ***
DESTIN_SZPRSZ02 -0.4942539  0.0052403   -94.319  < 2e-16 ***
DESTIN_SZPRSZ03  0.4219510  0.0040281   104.751  < 2e-16 ***
DESTIN_SZPRSZ04 -0.4841099  0.0083498   -57.979  < 2e-16 ***
DESTIN_SZPRSZ05 -0.2988481  0.0047512   -62.899  < 2e-16 ***
DESTIN_SZPRSZ06  0.0012333  0.0054530     0.226  0.82108    
DESTIN_SZPRSZ07 -1.1417482  0.0118845   -96.070  < 2e-16 ***
DESTIN_SZPRSZ08 -0.8259249  0.0066757  -123.720  < 2e-16 ***
DESTIN_SZQTSZ01 -1.2134330  0.0089222  -136.002  < 2e-16 ***
DESTIN_SZQTSZ02 -1.2397956  0.0074512  -166.388  < 2e-16 ***
DESTIN_SZQTSZ03 -0.7448659  0.0066511  -111.992  < 2e-16 ***
DESTIN_SZQTSZ04 -0.6243112  0.0066812   -93.443  < 2e-16 ***
DESTIN_SZQTSZ05 -0.6102589  0.0060458  -100.940  < 2e-16 ***
DESTIN_SZQTSZ06 -0.9164592  0.0065095  -140.788  < 2e-16 ***
DESTIN_SZQTSZ07 -1.4600643  0.0109976  -132.762  < 2e-16 ***
DESTIN_SZQTSZ08  0.0004582  0.0050178     0.091  0.92724    
DESTIN_SZQTSZ09 -0.5226213  0.0058901   -88.728  < 2e-16 ***
DESTIN_SZQTSZ10 -0.3867082  0.0055876   -69.208  < 2e-16 ***
DESTIN_SZQTSZ11  0.0260589  0.0055065     4.732 2.22e-06 ***
DESTIN_SZQTSZ12 -0.3387634  0.0072779   -46.547  < 2e-16 ***
DESTIN_SZQTSZ13 -0.0512118  0.0053664    -9.543  < 2e-16 ***
DESTIN_SZQTSZ14 -0.2555346  0.0063792   -40.057  < 2e-16 ***
DESTIN_SZQTSZ15 -0.1820651  0.0077537   -23.481  < 2e-16 ***
DESTIN_SZRCSZ01 -0.4641196  0.0072515   -64.003  < 2e-16 ***
DESTIN_SZRCSZ06 -2.0929548  0.0189106  -110.676  < 2e-16 ***
DESTIN_SZRVSZ01 -1.7885682  0.0163492  -109.398  < 2e-16 ***
DESTIN_SZRVSZ02 -3.1669721  0.0326320   -97.051  < 2e-16 ***
DESTIN_SZRVSZ03 -2.0306835  0.0135749  -149.591  < 2e-16 ***
DESTIN_SZRVSZ04 -1.5113470  0.0155637   -97.107  < 2e-16 ***
DESTIN_SZRVSZ05 -2.3683855  0.0259334   -91.326  < 2e-16 ***
DESTIN_SZSBSZ01 -0.5841063  0.0068588   -85.162  < 2e-16 ***
DESTIN_SZSBSZ02 -1.0777704  0.0078288  -137.667  < 2e-16 ***
DESTIN_SZSBSZ03  0.4734371  0.0045880   103.190  < 2e-16 ***
DESTIN_SZSBSZ04  0.0546094  0.0057517     9.494  < 2e-16 ***
DESTIN_SZSBSZ05 -0.9588198  0.0075242  -127.431  < 2e-16 ***
DESTIN_SZSBSZ06 -1.8528944  0.0234040   -79.170  < 2e-16 ***
DESTIN_SZSBSZ07 -1.8403768  0.0195878   -93.955  < 2e-16 ***
DESTIN_SZSBSZ08  0.9205969  0.0055698   165.285  < 2e-16 ***
DESTIN_SZSBSZ09  0.5166486  0.0051939    99.472  < 2e-16 ***
DESTIN_SZSESZ02 -0.5728211  0.0048270  -118.669  < 2e-16 ***
DESTIN_SZSESZ03  0.2554787  0.0038335    66.645  < 2e-16 ***
DESTIN_SZSESZ04 -0.8982794  0.0056698  -158.432  < 2e-16 ***
DESTIN_SZSESZ05 -0.4661655  0.0048578   -95.962  < 2e-16 ***
DESTIN_SZSESZ06 -0.8392849  0.0059198  -141.777  < 2e-16 ***
DESTIN_SZSESZ07 -3.2182325  0.0227089  -141.717  < 2e-16 ***
DESTIN_SZSGSZ01 -0.2751206  0.0059581   -46.176  < 2e-16 ***
DESTIN_SZSGSZ02 -0.2951806  0.0052515   -56.209  < 2e-16 ***
DESTIN_SZSGSZ03 -0.4469508  0.0048181   -92.766  < 2e-16 ***
DESTIN_SZSGSZ04 -0.2842809  0.0047961   -59.274  < 2e-16 ***
DESTIN_SZSGSZ05 -2.0643753  0.0098252  -210.109  < 2e-16 ***
DESTIN_SZSGSZ06  0.2501247  0.0038873    64.343  < 2e-16 ***
DESTIN_SZSGSZ07 -0.5743750  0.0052184  -110.067  < 2e-16 ***
DESTIN_SZSISZ01 -1.1030669  0.0259113   -42.571  < 2e-16 ***
DESTIN_SZSKSZ01 -0.5462538  0.0071443   -76.460  < 2e-16 ***
DESTIN_SZSKSZ02  0.2965180  0.0056707    52.290  < 2e-16 ***
DESTIN_SZSKSZ03 -0.4521490  0.0062177   -72.719  < 2e-16 ***
DESTIN_SZSKSZ04 -0.6665145  0.0148252   -44.958  < 2e-16 ***
DESTIN_SZSKSZ05 -0.1474142  0.0121958   -12.087  < 2e-16 ***
DESTIN_SZSLSZ01 -0.8855715  0.0084587  -104.693  < 2e-16 ***
DESTIN_SZSLSZ04 -1.1787840  0.0071355  -165.200  < 2e-16 ***
DESTIN_SZSRSZ01 -1.6435064  0.0128822  -127.580  < 2e-16 ***
DESTIN_SZTHSZ01 -3.4388625  0.0367651   -93.536  < 2e-16 ***
DESTIN_SZTHSZ03 -2.5809435  0.0256853  -100.483  < 2e-16 ***
DESTIN_SZTHSZ04 -2.4887189  0.0214441  -116.056  < 2e-16 ***
DESTIN_SZTHSZ06 -1.7965101  0.0152160  -118.067  < 2e-16 ***
DESTIN_SZTMSZ01 -0.3251891  0.0058067   -56.002  < 2e-16 ***
DESTIN_SZTMSZ02  1.1558743  0.0034703   333.080  < 2e-16 ***
DESTIN_SZTMSZ03  0.4525619  0.0039244   115.319  < 2e-16 ***
DESTIN_SZTMSZ04  0.8223271  0.0040060   205.274  < 2e-16 ***
DESTIN_SZTMSZ05  0.3880619  0.0054308    71.456  < 2e-16 ***
DESTIN_SZTNSZ01 -0.9533112  0.0067853  -140.496  < 2e-16 ***
DESTIN_SZTNSZ02 -1.5909451  0.0097396  -163.348  < 2e-16 ***
DESTIN_SZTNSZ03 -1.6470771  0.0116598  -141.261  < 2e-16 ***
DESTIN_SZTNSZ04 -1.0686173  0.0069848  -152.993  < 2e-16 ***
DESTIN_SZTPSZ01 -0.5180183  0.0056886   -91.063  < 2e-16 ***
DESTIN_SZTPSZ02  0.2160781  0.0038283    56.443  < 2e-16 ***
DESTIN_SZTPSZ03 -0.2479956  0.0056651   -43.776  < 2e-16 ***
DESTIN_SZTPSZ04 -1.5015463  0.0072444  -207.271  < 2e-16 ***
DESTIN_SZTPSZ05 -0.9551144  0.0057981  -164.729  < 2e-16 ***
DESTIN_SZTPSZ06 -0.4846634  0.0074621   -64.950  < 2e-16 ***
DESTIN_SZTPSZ07 -1.9753440  0.0118295  -166.984  < 2e-16 ***
DESTIN_SZTPSZ08 -1.3455063  0.0086909  -154.817  < 2e-16 ***
DESTIN_SZTPSZ09 -0.3556620  0.0061296   -58.024  < 2e-16 ***
DESTIN_SZTPSZ10 -1.3213501  0.0085951  -153.733  < 2e-16 ***
DESTIN_SZTPSZ11 -0.3877006  0.0052409   -73.977  < 2e-16 ***
DESTIN_SZTPSZ12 -0.7064020  0.0062472  -113.075  < 2e-16 ***
DESTIN_SZTSSZ01 -0.8827157  0.0218327   -40.431  < 2e-16 ***
DESTIN_SZTSSZ02 -0.6067055  0.0115514   -52.522  < 2e-16 ***
DESTIN_SZTSSZ03  0.4380259  0.0086774    50.479  < 2e-16 ***
DESTIN_SZTSSZ04  0.4902124  0.0089922    54.515  < 2e-16 ***
DESTIN_SZTSSZ05  1.4336278  0.0093410   153.477  < 2e-16 ***
DESTIN_SZTSSZ06  0.9223573  0.0209024    44.127  < 2e-16 ***
DESTIN_SZWCSZ01  1.1559309  0.0051787   223.208  < 2e-16 ***
DESTIN_SZWCSZ02 -1.2664455  0.0126131  -100.407  < 2e-16 ***
DESTIN_SZWCSZ03 -2.7360882  0.0325753   -83.993  < 2e-16 ***
DESTIN_SZWDSZ01  0.8193492  0.0037301   219.657  < 2e-16 ***
DESTIN_SZWDSZ02 -0.7852474  0.0058655  -133.875  < 2e-16 ***
DESTIN_SZWDSZ03  0.5742422  0.0041884   137.104  < 2e-16 ***
DESTIN_SZWDSZ04 -0.8391525  0.0065075  -128.951  < 2e-16 ***
DESTIN_SZWDSZ05 -0.3510692  0.0057253   -61.319  < 2e-16 ***
DESTIN_SZWDSZ06  0.1358804  0.0043968    30.905  < 2e-16 ***
DESTIN_SZWDSZ07 -0.2207379  0.0066369   -33.259  < 2e-16 ***
DESTIN_SZWDSZ08 -0.0264655  0.0065065    -4.068 4.75e-05 ***
DESTIN_SZWDSZ09 -0.2065828  0.0050524   -40.888  < 2e-16 ***
DESTIN_SZYSSZ01  0.7467996  0.0040979   182.238  < 2e-16 ***
DESTIN_SZYSSZ02 -0.3002718  0.0053434   -56.195  < 2e-16 ***
DESTIN_SZYSSZ03 -1.1087686  0.0057219  -193.778  < 2e-16 ***
DESTIN_SZYSSZ04 -0.3748076  0.0051481   -72.805  < 2e-16 ***
DESTIN_SZYSSZ05 -1.7909654  0.0102064  -175.475  < 2e-16 ***
DESTIN_SZYSSZ06 -1.8519179  0.0099601  -185.933  < 2e-16 ***
DESTIN_SZYSSZ07 -0.9246626  0.0118101   -78.294  < 2e-16 ***
DESTIN_SZYSSZ08  0.4403129  0.0041268   106.697  < 2e-16 ***
DESTIN_SZYSSZ09  0.0267012  0.0041393     6.451 1.11e-10 ***
log(dist)       -0.6721961  0.0001353 -4969.566  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 60796037  on 14733  degrees of freedom
Residual deviance: 20988409  on 14175  degrees of freedom
AIC: 21081154

Number of Fisher Scoring iterations: 7

We can compute for the R-squared using the following

CalcRSquared(dbcSIM$data$TRIPS, dbcSIM$fitted.values)
[1] 0.5739638

Model comparison

Model performance can also be measured using the RMSE or root mean square error. We can use the performance package to compare different models’ performance using metrics like RMSE

First, we create an object containing the models to be compared

model_list <- list(unconstrained=uncSIM,
                   originConstrained=orcSIM,
                   destinationConstrained=decSIM,
                   doublyConstrained=dbcSIM)

Next, we compute for the RMSE for the models and show the results

compare_performance(model_list,
                    metrics = "RMSE")
# Comparison of Model Performance Indices

Name                   | Model |     RMSE
-----------------------------------------
unconstrained          |   glm | 4288.012
originConstrained      |   glm | 3659.954
destinationConstrained |   glm | 3389.556
doublyConstrained      |   glm | 3252.297

The output shows that the doubly constrained model has the best performance using RMSE as it has the lowest value among the four

Visualizing fitted values

In this last section, we learn to visualize the fitted versus the actual values

Forst, we need to extract the fitted values of the unconstrained model

df <- as.data.frame(uncSIM$fitted.values) %>%
  round(digits = 0)

Next, we join this with the object SIM_data

SIM_data <- SIM_data %>%
  cbind(df) %>%
  rename(uncTRIPS = "uncSIM$fitted.values")

We repeat the same for every model.

df <- as.data.frame(orcSIM$fitted.values) %>%
  round(digits = 0)
SIM_data <- SIM_data %>%
  cbind(df) %>%
  rename(orcTRIPS = "orcSIM$fitted.values")
df <- as.data.frame(decSIM$fitted.values) %>%
  round(digits = 0)
SIM_data <- SIM_data %>%
  cbind(df) %>%
  rename(decTRIPS = "decSIM$fitted.values")
df <- as.data.frame(dbcSIM$fitted.values) %>%
  round(digits = 0)
SIM_data <- SIM_data %>%
  cbind(df) %>%
  rename(dbcTRIPS = "dbcSIM$fitted.values")

We then prepare the different plots and store them into separate objects

unc_p <- ggplot(data = SIM_data,
                aes(x = uncTRIPS,
                    y = TRIPS)) +
  geom_point() +
  geom_smooth(method = lm)

orc_p <- ggplot(data = SIM_data,
                aes(x = orcTRIPS,
                    y = TRIPS)) +
  geom_point() +
  geom_smooth(method = lm)

dec_p <- ggplot(data = SIM_data,
                aes(x = decTRIPS,
                    y = TRIPS)) +
  geom_point() +
  geom_smooth(method = lm)

dbc_p <- ggplot(data = SIM_data,
                aes(x = dbcTRIPS,
                    y = TRIPS)) +
  geom_point() +
  geom_smooth(method = lm)

Next, we display the plots in a 2x2 grid so they can be easily compared against one another

ggarrange(unc_p, orc_p, dec_p, dbc_p,
          ncol = 2,
          nrow = 2)
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'